Chromium Code Reviews| Index: src/runtime-profiler.cc |
| =================================================================== |
| --- src/runtime-profiler.cc (revision 5961) |
| +++ src/runtime-profiler.cc (working copy) |
| @@ -424,17 +424,22 @@ |
| bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
| static const int kNonJSTicksThreshold = 100; |
| + bool top_is_in_js_state = Top::IsInJSState(); |
| + // Record state sample. |
| + if (top_is_in_js_state) { |
|
Florian Schneider
2010/12/10 14:02:55
Do you need to check for RuntimeProfiler::IsEnable
Karl Klose
2010/12/10 14:08:48
Done.
|
| + AddStateSample(IN_JS_STATE); |
| + } else { |
| + AddStateSample(IN_NON_JS_STATE); |
| + } |
| // We suspend the runtime profiler thread when not running |
| // JavaScript. If the CPU profiler is active we must not do this |
| // because it samples both JavaScript and C++ code. |
| if (RuntimeProfiler::IsEnabled() && |
| !CpuProfiler::is_profiling() && |
| !(FLAG_prof && FLAG_prof_auto)) { |
| - if (Top::IsInJSState()) { |
| - AddStateSample(IN_JS_STATE); |
| + if (top_is_in_js_state) { |
| non_js_ticks_ = 0; |
| } else { |
| - AddStateSample(IN_NON_JS_STATE); |
| if (non_js_ticks_ < kNonJSTicksThreshold) { |
| ++non_js_ticks_; |
| } else { |