Chromium Code Reviews| Index: src/counters.cc |
| diff --git a/src/counters.cc b/src/counters.cc |
| index faad6d409ade1cdb7acac4d2c1f72488d0136d28..10213f3e481ecb86c11b58cc1d79069a5fe82c43 100644 |
| --- a/src/counters.cc |
| +++ b/src/counters.cc |
| @@ -64,9 +64,19 @@ void StatsCounterTimer::Stop() { |
| counter_.Increment(milliseconds); |
| } |
| +void Histogram::AddSample(int sample) { |
| + if (Enabled()) |
|
Michael Starzinger
2012/07/02 21:09:56
Curly brackets if not on one line.
jochen (gone - plz use gerrit)
2012/07/13 09:48:08
Done.
|
| + Isolate::Current()->stats_table()->AddHistogramSample(histogram_, sample); |
| +} |
| + |
| +void* Histogram::CreateHistogram() const { |
| + return Isolate::Current()->stats_table()-> |
| + CreateHistogram(name_, min_, max_, num_buckets_); |
| +} |
| + |
| // Start the timer. |
| void HistogramTimer::Start() { |
| - if (GetHistogram() != NULL) { |
| + if (histogram_.Enabled()) { |
| stop_time_ = 0; |
| start_time_ = OS::Ticks(); |
| } |
| @@ -74,20 +84,13 @@ void HistogramTimer::Start() { |
| // Stop the timer and record the results. |
| void HistogramTimer::Stop() { |
| - if (histogram_ != NULL) { |
| + if (histogram_.Enabled()) { |
| stop_time_ = OS::Ticks(); |
| // Compute the delta between start and stop, in milliseconds. |
| int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; |
| - Isolate::Current()->stats_table()-> |
| - AddHistogramSample(histogram_, milliseconds); |
| + histogram_.AddSample(milliseconds); |
| } |
| } |
| - |
| -void* HistogramTimer::CreateHistogram() const { |
| - return Isolate::Current()->stats_table()-> |
| - CreateHistogram(name_, 0, 10000, 50); |
| -} |
| - |
| } } // namespace v8::internal |