Revert "Return start/end profiling time in microseconds instead of milliseconds"
authorbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 5 Aug 2013 12:27:12 +0000 (12:27 +0000)
committerbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 5 Aug 2013 12:27:12 +0000 (12:27 +0000)
This reverts r16049 for breaking build on windows.

TBR=svenpanne@chromium.org,machenbach@chromium.org

Review URL: https://codereview.chromium.org/22189002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16050 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

include/v8-profiler.h
src/api.cc
src/profile-generator.cc
src/profile-generator.h
test/cctest/test-cpu-profiler.cc

index 7898fef..7a71bf1 100644 (file)
@@ -149,16 +149,16 @@ class V8EXPORT CpuProfile {
   const CpuProfileNode* GetSample(int index) const;
 
   /**
-    * Returns time when the profile recording started (in microseconds
+    * Returns time when the profile recording started (in milliseconds
     * since the Epoch).
     */
-  int64_t GetStartTime() const;
+  double GetStartTime() const;
 
   /**
-    * Returns time when the profile recording was stopped (in microseconds
+    * Returns time when the profile recording was stopped (in milliseconds
     * since the Epoch).
     */
-  int64_t GetEndTime() const;
+  double GetEndTime() const;
 
   /**
    * Deletes the profile and removes it from CpuProfiler's list.
index c0f7a97..100ddc2 100644 (file)
@@ -7591,15 +7591,15 @@ const CpuProfileNode* CpuProfile::GetSample(int index) const {
 }
 
 
-int64_t CpuProfile::GetStartTime() const {
+double CpuProfile::GetStartTime() const {
   const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return profile->start_time_us();
+  return profile->start_time_ms();
 }
 
 
-int64_t CpuProfile::GetEndTime() const {
+double CpuProfile::GetEndTime() const {
   const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
-  return profile->end_time_us();
+  return profile->end_time_ms();
 }
 
 
index e772a54..4e2e389 100644 (file)
@@ -376,8 +376,8 @@ CpuProfile::CpuProfile(const char* title, unsigned uid, bool record_samples)
     : title_(title),
       uid_(uid),
       record_samples_(record_samples),
-      start_time_us_(OS::Ticks()),
-      end_time_us_(0) {
+      start_time_ms_(OS::TimeCurrentMillis()),
+      end_time_ms_(0) {
 }
 
 
@@ -388,13 +388,13 @@ void CpuProfile::AddPath(const Vector<CodeEntry*>& path) {
 
 
 void CpuProfile::CalculateTotalTicksAndSamplingRate() {
-  end_time_us_ = OS::Ticks();
+  end_time_ms_ = OS::TimeCurrentMillis();
   top_down_.CalculateTotalTicks();
 
-  double duration_ms = (end_time_us_ - start_time_us_) / 1000.;
-  if (duration_ms < 1) duration_ms = 1;
+  double duration = end_time_ms_ - start_time_ms_;
+  if (duration < 1) duration = 1;
   unsigned ticks = top_down_.root()->total_ticks();
-  double rate = ticks / duration_ms;
+  double rate = ticks / duration;
   top_down_.SetTickRatePerMs(rate);
 }
 
index 0cc397e..ce2dd30 100644 (file)
@@ -216,8 +216,8 @@ class CpuProfile {
   int samples_count() const { return samples_.length(); }
   ProfileNode* sample(int index) const { return samples_.at(index); }
 
-  int64_t start_time_us() const { return start_time_us_; }
-  int64_t end_time_us() const { return end_time_us_; }
+  double start_time_ms() const { return start_time_ms_; }
+  double end_time_ms() const { return end_time_ms_; }
 
   void UpdateTicksScale();
 
@@ -228,8 +228,8 @@ class CpuProfile {
   const char* title_;
   unsigned uid_;
   bool record_samples_;
-  int64_t start_time_us_;
-  int64_t end_time_us_;
+  double start_time_ms_;
+  double end_time_ms_;
   List<ProfileNode*> samples_;
   ProfileTree top_down_;
 
index 0dfbb2c..3f0fb80 100644 (file)
@@ -415,13 +415,13 @@ TEST(ProfileStartEndTime) {
   v8::HandleScope scope(env->GetIsolate());
   v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
 
-  double time_before_profiling = i::OS::Ticks();
+  double time_before_profiling = i::OS::TimeCurrentMillis();
   v8::Local<v8::String> profile_name = v8::String::New("test");
   cpu_profiler->StartCpuProfiling(profile_name);
   const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
   CHECK(time_before_profiling <= profile->GetStartTime());
   CHECK(profile->GetStartTime() <= profile->GetEndTime());
-  CHECK(profile->GetEndTime() <= i::OS::Ticks());
+  CHECK(profile->GetEndTime() <= i::OS::TimeCurrentMillis());
 }