Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / base / profiler / scoped_profile.cc
index 93c86e9..e1edc97 100644 (file)
@@ -12,8 +12,8 @@ namespace tracked_objects {
 
 
 ScopedProfile::ScopedProfile(const Location& location)
-    : birth_(ThreadData::TallyABirthIfActive(location)),
-      start_of_run_(ThreadData::NowForStartOfRun(birth_)) {
+    : birth_(ThreadData::TallyABirthIfActive(location)) {
+  ThreadData::PrepareForStartOfRun(birth_);
 }
 
 ScopedProfile::~ScopedProfile() {
@@ -21,10 +21,11 @@ ScopedProfile::~ScopedProfile() {
 }
 
 void ScopedProfile::StopClockAndTally() {
+  stopwatch_.Stop();
+
   if (!birth_)
     return;
-  ThreadData::TallyRunInAScopedRegionIfTracking(birth_, start_of_run_,
-                                                ThreadData::NowForEndOfRun());
+  ThreadData::TallyRunInAScopedRegionIfTracking(birth_, stopwatch_);
   birth_ = NULL;
 }