Appendix log for ttrace
[platform/core/uifw/dali-adaptor.git] / dali / internal / trace / generic / trace-manager-impl-generic.cpp
index 92ada6e..933a4e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -40,17 +40,24 @@ Dali::Integration::Trace::LogContextFunction TraceManagerGeneric::GetLogContextF
   return LogContext;
 }
 
-void TraceManagerGeneric::LogContext(bool start, const char* tag)
+void TraceManagerGeneric::LogContext(bool start, const char* tag, const char* message)
 {
-  if(start)
+  if(traceManagerGeneric && traceManagerGeneric->mPerformanceInterface)
   {
-    unsigned short contextId = traceManagerGeneric->mPerformanceInterface->AddContext(tag);
-    traceManagerGeneric->mPerformanceInterface->AddMarker(PerformanceInterface::START, contextId);
-  }
-  else
-  {
-    unsigned short contextId = traceManagerGeneric->mPerformanceInterface->AddContext(tag);
-    traceManagerGeneric->mPerformanceInterface->AddMarker(PerformanceInterface::END, contextId);
+    if(start)
+    {
+      unsigned short contextId = traceManagerGeneric->mPerformanceInterface->GetContextId(tag);
+      if(!contextId)
+      {
+        contextId = traceManagerGeneric->mPerformanceInterface->AddContext(tag);
+      }
+      traceManagerGeneric->mPerformanceInterface->AddMarker(PerformanceInterface::START, contextId);
+    }
+    else
+    {
+      unsigned short contextId = traceManagerGeneric->mPerformanceInterface->GetContextId(tag);
+      traceManagerGeneric->mPerformanceInterface->AddMarker(PerformanceInterface::END, contextId);
+    }
   }
 }