Reviewers: loislo, alph, Jakob,

Description:
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

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

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

Affected files:
  M test/cctest/test-cpu-profiler.cc


Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 5edfc912699bbd74b9687c6e9f48c8328a5a721d..901c1161fceea69cfbb2578ff2cfe230b71744c3 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -651,12 +651,14 @@ static const char* native_accessor_test_source = "function start(count) {\n"
 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 @@ class FooAccessorsData {
                      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 @@ class FooAccessorsData {
   }

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


@@ -723,6 +734,7 @@ TEST(NativeAccessorNameInProfile1) {
   // 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