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

Unified Diff: src/runtime-profiler.cc

Issue 6826026: Fix JS ratio computation on startup. (Closed)
Patch Set: Created 9 years, 8 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 | « src/runtime-profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime-profiler.cc
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc
index 28755e3ebef77cd11c2beb460adede8460fd5b4d..028af49f12dffdee37ad34613668e2bb28c63ec3 100644
--- a/src/runtime-profiler.cc
+++ b/src/runtime-profiler.cc
@@ -130,9 +130,11 @@ RuntimeProfiler::RuntimeProfiler(Isolate* isolate)
js_ratio_(0),
sampler_window_position_(0),
optimize_soon_list_(NULL),
- state_window_position_(0) {
- state_counts_[0] = kStateWindowSize;
- state_counts_[1] = 0;
+ state_window_position_(0),
+ state_window_ticks_(0) {
+ state_counts_[IN_NON_JS_STATE] = kStateWindowSize;
Vyacheslav Egorov (Chromium) 2011/04/09 17:00:21 Wild idea: when going idle we stop profiler. Why d
Vitaly Repeshko 2011/04/10 08:13:27 I agree. As we discussed, we should revisit the he
Kasper Lund 2011/04/11 06:10:06 Before this change, we were intentionally being le
Vitaly Repeshko 2011/04/11 19:43:53 The slow start is still here, because even if we o
+ state_counts_[IN_JS_STATE] = 0;
+ STATIC_ASSERT(IN_NON_JS_STATE == 0);
memset(state_window_, 0, sizeof(state_window_));
ClearSampleBuffer();
}
@@ -344,8 +346,9 @@ void RuntimeProfiler::UpdateStateRatio(SamplerState current_state) {
ASSERT(IsPowerOf2(kStateWindowSize));
state_window_position_ = (state_window_position_ + 1) &
(kStateWindowSize - 1);
+ state_window_ticks_ = Min(kStateWindowSize, state_window_ticks_ + 1);
Vyacheslav Egorov (Chromium) 2011/04/09 17:00:21 Our RuntimeProfiler is full of magic and very hard
Vitaly Repeshko 2011/04/10 08:13:27 It's not too late to make it readable :) Added a c
NoBarrier_Store(&js_ratio_, state_counts_[IN_JS_STATE] * 100 /
- kStateWindowSize);
+ state_window_ticks_);
}
#endif
« no previous file with comments | « src/runtime-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698