Reviewers: yurys, loislo, Jakob,

Message:
Folks, could you please take a look.

Description:
Switch CPU profile start/stop markers to monotonic time.

LOG=N
BUG=363976

Please review this at https://codereview.chromium.org/243033002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+10, -14 lines):
  M include/v8-profiler.h
  M src/api.cc
  M src/profile-generator.h
  M src/profile-generator.cc


Index: include/v8-profiler.h
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index f5b760a402538e7b2c6cffe3a5ffb06e9fd55805..309a0754e36dc813dd77a9ad7cb3702f28d91ab6 100644
--- a/include/v8-profiler.h
+++ b/include/v8-profiler.h
@@ -118,14 +118,12 @@ class V8_EXPORT CpuProfile {
   const CpuProfileNode* GetSample(int index) const;

   /**
-    * Returns time when the profile recording started (in microseconds
-    * since the Epoch).
+ * Returns time when the profile recording was started (in microseconds).
     */
   int64_t GetStartTime() const;

   /**
-    * Returns time when the profile recording was stopped (in microseconds
-    * since the Epoch).
+ * Returns time when the profile recording was stopped (in microseconds).
     */
   int64_t GetEndTime() const;

Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 3550bb04de9697ab9df06872172c6ffc91aa2c43..1530ff03f340a3206624d6ba99ee100a8fbe2002 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -7084,13 +7084,13 @@ const CpuProfileNode* CpuProfile::GetSample(int index) const {

 int64_t CpuProfile::GetStartTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return (profile->start_time() - i::Time::UnixEpoch()).InMicroseconds();
+  return (profile->start_time() - i::TimeTicks()).InMicroseconds();
 }


 int64_t CpuProfile::GetEndTime() const {
const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds();
+  return (profile->end_time() - i::TimeTicks()).InMicroseconds();
 }


Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 6bd446e0c49d471348fc2548beb342b9e1804ab1..ae37648e5ea99cb1cf754cbafb56c5f020575ce1 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -355,8 +355,7 @@ void ProfileTree::TraverseDepthFirst(Callback* callback) {
 CpuProfile::CpuProfile(const char* title, bool record_samples)
     : title_(title),
       record_samples_(record_samples),
-      start_time_(Time::NowFromSystemTime()) {
-  timer_.Start();
+      start_time_(TimeTicks::HighResolutionNow()) {
 }


@@ -367,7 +366,7 @@ void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {


 void CpuProfile::CalculateTotalTicksAndSamplingRate() {
-  end_time_ = start_time_ + timer_.Elapsed();
+  end_time_ = TimeTicks::HighResolutionNow();
 }


Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index 81980bfc9931defcdbfc033cea866e8565190923..1f23ee20ffe5bf8827bb28de6800568814a02b61 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -208,8 +208,8 @@ class CpuProfile {
   int samples_count() const { return samples_.length(); }
   ProfileNode* sample(int index) const { return samples_.at(index); }

-  Time start_time() const { return start_time_; }
-  Time end_time() const { return end_time_; }
+  TimeTicks start_time() const { return start_time_; }
+  TimeTicks end_time() const { return end_time_; }

   void UpdateTicksScale();

@@ -218,9 +218,8 @@ class CpuProfile {
  private:
   const char* title_;
   bool record_samples_;
-  Time start_time_;
-  Time end_time_;
-  ElapsedTimer timer_;
+  TimeTicks start_time_;
+  TimeTicks end_time_;
   List<ProfileNode*> samples_;
   ProfileTree top_down_;



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to