Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Unified Diff: test/cctest/test-cpu-profiler.cc

Issue 16527006: Print accessors loop iterations count in test-cpu-profiler/NativeAccessorNameInProfile1 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 901c1161fceea69cfbb2578ff2cfe230b71744c3..a4a525d8fe98f70618fd64bf14834cbf1f96d99c 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -653,12 +653,14 @@ class FooAccessorsData {
explicit FooAccessorsData(int min_duration_ms)
: min_duration_ms_(min_duration_ms),
getter_duration_(0),
- setter_duration_(0) {}
+ setter_duration_(0),
+ getter_iterations_(0),
+ setter_iterations_(0) {}
static v8::Handle<v8::Value> Getter(v8::Local<v8::String> name,
const v8::AccessorInfo& info) {
FooAccessorsData* data = fromInfo(info);
- data->getter_duration_ = data->Wait();
+ data->getter_duration_ = data->Wait(&data->getter_iterations_);
return v8::Int32::New(2013);
}
@@ -666,20 +668,21 @@ class FooAccessorsData {
v8::Local<v8::Value> value,
const v8::AccessorInfo& info) {
FooAccessorsData* data = fromInfo(info);
- data->setter_duration_ = data->Wait();
+ data->setter_duration_ = data->Wait(&data->setter_iterations_);
}
void PrintAccessorTime() {
- i::OS::Print("getter: %f ms; setter: %f ms\n", getter_duration_,
- setter_duration_);
+ i::OS::Print("getter: %f ms (%d); setter: %f ms (%d)\n", getter_duration_,
+ getter_iterations_, setter_duration_, setter_iterations_);
}
private:
- double Wait() {
+ double Wait(int* iterations) {
double start = i::OS::TimeCurrentMillis();
double duration = 0;
while (duration < min_duration_ms_) {
duration = i::OS::TimeCurrentMillis() - start;
+ ++*iterations;
}
return duration;
}
@@ -692,6 +695,8 @@ class FooAccessorsData {
int min_duration_ms_;
double getter_duration_;
double setter_duration_;
+ int getter_iterations_;
+ int setter_iterations_;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698