Print the name of processor when we execute it 61/302961/4
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 18 Dec 2023 05:50:37 +0000 (14:50 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 19 Dec 2023 06:18:40 +0000 (15:18 +0900)
Get the name of processor what we are processing now, for debug.

Change-Id: I2bb45e85987a75d1651fea9d3d2f74ef0be990a7
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-Processors.cpp
dali/integration-api/processor-interface.h
dali/internal/common/core-impl.cpp

index c118011..74a6ed1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -36,6 +36,11 @@ public:
     processRun = true;
   }
 
+  std::string_view GetProcessorName() const override
+  {
+    return "TestProcessor";
+  }
+
   bool processRun;
 };
 
@@ -56,6 +61,11 @@ public:
     }
   }
 
+  std::string_view GetProcessorName() const override
+  {
+    return "NewTestProcessor";
+  }
+
   void SetProcessorToUnregister(Integration::Processor* processor)
   {
     unregisterProcessor = processor;
@@ -260,3 +270,18 @@ int UtcDaliCoreProcessorUnregisterDuringCallback02(void)
 
   END_TEST;
 }
+
+int UtcDaliCoreProcessorGetProcessorName(void)
+{
+  // Test post-processor
+  TestApplication    application;
+  Integration::Core& core = application.GetCore();
+
+  NewTestProcessor testProcessor1(core);
+  TestProcessor    testProcessor2;
+
+  DALI_TEST_EQUALS(std::string(testProcessor1.GetProcessorName()), "NewTestProcessor", TEST_LOCATION);
+  DALI_TEST_EQUALS(std::string(testProcessor2.GetProcessorName()), "TestProcessor", TEST_LOCATION);
+
+  END_TEST;
+}
index 45408ff..db3de65 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_PROCESSOR_INTERFACE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <string_view>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 
@@ -37,6 +40,12 @@ public:
    */
   virtual void Process(bool postProcessor = false) = 0;
 
+  /**
+   * @brief Get the name of this processor if we setup.
+   * @return The name of this processor.
+   */
+  virtual std::string_view GetProcessorName() const = 0;
+
 protected:
   /**
    * Virtual protected destructor
index e9da296..ddb622f 100644 (file)
@@ -449,7 +449,23 @@ void Core::RunProcessors()
       {
         if(!mProcessorUnregistered)
         {
+#ifdef TRACE_ENABLED
+          if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+          {
+            std::ostringstream stream;
+            stream << "[" << processor->GetProcessorName() << "]";
+            DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSOR", stream.str().c_str());
+          }
+#endif
           processor->Process(false);
+#ifdef TRACE_ENABLED
+          if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+          {
+            std::ostringstream stream;
+            stream << "[" << processor->GetProcessorName() << "]";
+            DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSOR", stream.str().c_str());
+          }
+#endif
         }
         else
         {
@@ -458,7 +474,23 @@ void Core::RunProcessors()
           auto iter = std::find(mProcessors.Begin(), mProcessors.End(), processor);
           if(iter != mProcessors.End())
           {
+#ifdef TRACE_ENABLED
+            if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+            {
+              std::ostringstream stream;
+              stream << "[" << processor->GetProcessorName() << "]";
+              DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSOR", stream.str().c_str());
+            }
+#endif
             processor->Process(false);
+#ifdef TRACE_ENABLED
+            if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+            {
+              std::ostringstream stream;
+              stream << "[" << processor->GetProcessorName() << "]";
+              DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSOR", stream.str().c_str());
+            }
+#endif
           }
         }
       }
@@ -504,7 +536,23 @@ void Core::RunPostProcessors()
       {
         if(!mPostProcessorUnregistered)
         {
+#ifdef TRACE_ENABLED
+          if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+          {
+            std::ostringstream stream;
+            stream << "[" << processor->GetProcessorName() << "]";
+            DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSOR", stream.str().c_str());
+          }
+#endif
           processor->Process(true);
+#ifdef TRACE_ENABLED
+          if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+          {
+            std::ostringstream stream;
+            stream << "[" << processor->GetProcessorName() << "]";
+            DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSOR", stream.str().c_str());
+          }
+#endif
         }
         else
         {
@@ -513,7 +561,23 @@ void Core::RunPostProcessors()
           auto iter = std::find(mPostProcessors.Begin(), mPostProcessors.End(), processor);
           if(iter != mPostProcessors.End())
           {
+#ifdef TRACE_ENABLED
+            if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+            {
+              std::ostringstream stream;
+              stream << "[" << processor->GetProcessorName() << "]";
+              DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSOR", stream.str().c_str());
+            }
+#endif
             processor->Process(true);
+#ifdef TRACE_ENABLED
+            if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+            {
+              std::ostringstream stream;
+              stream << "[" << processor->GetProcessorName() << "]";
+              DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSOR", stream.str().c_str());
+            }
+#endif
           }
         }
       }