Appendix log for ttrace
[platform/core/uifw/dali-adaptor.git] / dali / internal / trace / generic / trace-manager-impl-generic.cpp
index e741a64..933a4e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
  */
 
 // EXTERNAL INCLUDES
-#include <dali/internal/system/common/performance-interface.h>
 #include "trace-manager-impl-generic.h"
+#include <dali/internal/system/common/performance-interface.h>
 
 // INTERNAL INCLUDES
 
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace Adaptor
 {
-
 TraceManagerGeneric* TraceManagerGeneric::traceManagerGeneric = nullptr;
 
-TraceManagerGeneric::TraceManagerGeneric( PerformanceInterface* performanceInterface )
-: TraceManager( performanceInterface )
+TraceManagerGeneric::TraceManagerGeneric(PerformanceInterface* performanceInterface)
+: TraceManager(performanceInterface)
 {
   TraceManagerGeneric::traceManagerGeneric = this;
 }
@@ -43,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 )
-  {
-    unsigned short contextId = traceManagerGeneric->mPerformanceInterface->AddContext( tag );
-    traceManagerGeneric->mPerformanceInterface->AddMarker( PerformanceInterface::START, contextId );
-  }
-  else
+  if(traceManagerGeneric && traceManagerGeneric->mPerformanceInterface)
   {
-    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);
+    }
   }
 }