Revision: 14945
Author:   [email protected]
Date:     Tue Jun  4 23:15:41 2013
Log: Print accessors execution time in test-cpu-profiler/NativeAccessorNameInProfile1

The test is failing on Win64 bot but passes locally I need this debug print to better understand what's different on the bot.

BUG=None
[email protected]

Review URL: https://codereview.chromium.org/16359016
http://code.google.com/p/v8/source/detail?r=14945

Modified:
 /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Tue Jun 4 03:57:32 2013 +++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Tue Jun 4 23:15:41 2013
@@ -651,12 +651,14 @@
 class FooAccessorsData {
  public:
   explicit FooAccessorsData(int min_duration_ms)
-      : min_duration_ms_(min_duration_ms) {}
+      : min_duration_ms_(min_duration_ms),
+        getter_duration_(0),
+        setter_duration_(0) {}

   static v8::Handle<v8::Value> Getter(v8::Local<v8::String> name,
                                       const v8::AccessorInfo& info) {
     FooAccessorsData* data = fromInfo(info);
-    data->Wait();
+    data->getter_duration_ = data->Wait();
     return v8::Int32::New(2013);
   }

@@ -664,15 +666,22 @@
                      v8::Local<v8::Value> value,
                      const v8::AccessorInfo& info) {
     FooAccessorsData* data = fromInfo(info);
-    data->Wait();
+    data->setter_duration_ = data->Wait();
+  }
+
+  void PrintAccessorTime() {
+    i::OS::Print("getter: %f ms; setter: %f ms\n", getter_duration_,
+        setter_duration_);
   }

  private:
-  void Wait() {
+  double Wait() {
     double start = i::OS::TimeCurrentMillis();
-    for (double duration = 0; duration < min_duration_ms_; ) {
+    double duration = 0;
+    while (duration < min_duration_ms_) {
       duration = i::OS::TimeCurrentMillis() - start;
     }
+    return duration;
   }

   static FooAccessorsData* fromInfo(const v8::AccessorInfo& info) {
@@ -681,6 +690,8 @@
   }

   int min_duration_ms_;
+  double getter_duration_;
+  double setter_duration_;
 };


@@ -723,6 +734,7 @@
   // Dump collected profile to have a better diagnostic in case of failure.
   reinterpret_cast<i::CpuProfile*>(
       const_cast<v8::CpuProfile*>(profile))->Print();
+  accessors.PrintAccessorTime();

   const v8::CpuProfileNode* root = profile->GetTopDownRoot();
   const v8::CpuProfileNode* startNode = GetChild(root, "start");

--
--
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/groups/opt_out.


Reply via email to