Apply T-trace
authorJongHeon Choi <j-h.choi@samsung.com>
Thu, 25 Feb 2016 02:40:59 +0000 (11:40 +0900)
committerJongHeon Choi <j-h.choi@samsung.com>
Mon, 29 Feb 2016 02:25:11 +0000 (11:25 +0900)
common/common.gyp
common/profiler.cc
common/profiler.h
packaging/crosswalk-tizen.spec

index 9cbb6eb..f399892 100644 (file)
@@ -53,6 +53,7 @@
           'wgt-manifest-handlers',
           'pkgmgr-info',
           'glib-2.0',
+          'ttrace',
         ],
       },
       'direct_dependent_settings': {
index e619f3c..0f63aa6 100644 (file)
@@ -17,6 +17,7 @@
 #include "common/profiler.h"
 
 #include <math.h>
+#include <ttrace.h>
 
 #include "common/logger.h"
 #include "common/string_utils.h"
@@ -41,19 +42,36 @@ void PrintProfileLog(const char* func, const char* tag) {
                 << func << ":" << tag;
 }
 
-ScopeProfile::ScopeProfile(const char* step) : step_(step), expired_(false) {
+ScopeProfile::ScopeProfile(const char* step, const bool isStep)
+  : step_(step), expired_(false), isStep_(isStep) {
   clock_gettime(CLOCK_REALTIME, &start_);
   PrintProfileLog(step, "START");
+
+  if(isStep_)
+    traceAsyncBegin(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str());
+  else
+    traceBegin(TTRACE_TAG_WEB,"%s%s", "XWALK:", step_.c_str());
 }
 
 ScopeProfile::~ScopeProfile() {
-  if (!expired_)
+  if (!expired_) {
     PrintProfileTime(step_.c_str(), start_);
+
+    if(isStep_)
+      traceAsyncEnd(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str());
+    else
+      traceEnd(TTRACE_TAG_WEB);
+  }
 }
 
 void ScopeProfile::Reset() {
   clock_gettime(CLOCK_REALTIME, &start_);
   PrintProfileLog(step_.c_str(), "START-updated");
+
+  if(isStep_)
+    traceAsyncEnd(TTRACE_TAG_WEB, 0, "%s%s", "XWALK:", step_.c_str());
+  else
+    traceEnd(TTRACE_TAG_WEB);
 }
 
 void ScopeProfile::End() {
@@ -73,7 +91,7 @@ StepProfile::~StepProfile() {
 }
 
 void StepProfile::Start(const char* step) {
-  map_[step].reset(new ScopeProfile(step));
+  map_[step].reset(new ScopeProfile(step, true));
 }
 
 void StepProfile::End(const char* step) {
index 51dd908..663ba6b 100644 (file)
@@ -33,7 +33,7 @@ void PrintProfileLog(const char* func, const char* tag);
 
 class ScopeProfile {
  public:
-  explicit ScopeProfile(const char* step);
+  explicit ScopeProfile(const char* step, const bool isStep);
   ~ScopeProfile();
   void Reset();
   void End();
@@ -41,6 +41,7 @@ class ScopeProfile {
   std::string step_;
   struct timespec start_;
   bool expired_;
+  bool isStep_;
 };
 
 class StepProfile {
@@ -59,7 +60,7 @@ class StepProfile {
 }  // namespace common
 
 #define SCOPE_PROFILE() \
-  common::ScopeProfile __profile(__FUNCTION__);
+  common::ScopeProfile __profile(__FUNCTION__, false);
 
 #define STEP_PROFILE_START(x) \
   common::StepProfile::GetInstance()->Start(x)
index 96ec578..c3f64c0 100755 (executable)
@@ -42,6 +42,7 @@ BuildRequires: pkgconfig(pkgmgr-info)
 BuildRequires: pkgconfig(sqlite3)
 BuildRequires: pkgconfig(uuid)
 BuildRequires: pkgconfig(launchpad)
+BuildRequires: pkgconfig(ttrace)
 
 Requires: /usr/bin/systemctl