Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
|
Michael Starzinger
2012/07/02 21:09:56
2012
jochen (gone - plz use gerrit)
2012/07/13 09:48:08
Done.
| |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 void StatsCounterTimer::Stop() { | 57 void StatsCounterTimer::Stop() { |
| 58 if (!counter_.Enabled()) | 58 if (!counter_.Enabled()) |
| 59 return; | 59 return; |
| 60 stop_time_ = OS::Ticks(); | 60 stop_time_ = OS::Ticks(); |
| 61 | 61 |
| 62 // Compute the delta between start and stop, in milliseconds. | 62 // Compute the delta between start and stop, in milliseconds. |
| 63 int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; | 63 int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; |
| 64 counter_.Increment(milliseconds); | 64 counter_.Increment(milliseconds); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void Histogram::AddSample(int sample) { | |
| 68 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.
| |
| 69 Isolate::Current()->stats_table()->AddHistogramSample(histogram_, sample); | |
| 70 } | |
| 71 | |
| 72 void* Histogram::CreateHistogram() const { | |
| 73 return Isolate::Current()->stats_table()-> | |
| 74 CreateHistogram(name_, min_, max_, num_buckets_); | |
| 75 } | |
| 76 | |
| 67 // Start the timer. | 77 // Start the timer. |
| 68 void HistogramTimer::Start() { | 78 void HistogramTimer::Start() { |
| 69 if (GetHistogram() != NULL) { | 79 if (histogram_.Enabled()) { |
| 70 stop_time_ = 0; | 80 stop_time_ = 0; |
| 71 start_time_ = OS::Ticks(); | 81 start_time_ = OS::Ticks(); |
| 72 } | 82 } |
| 73 } | 83 } |
| 74 | 84 |
| 75 // Stop the timer and record the results. | 85 // Stop the timer and record the results. |
| 76 void HistogramTimer::Stop() { | 86 void HistogramTimer::Stop() { |
| 77 if (histogram_ != NULL) { | 87 if (histogram_.Enabled()) { |
| 78 stop_time_ = OS::Ticks(); | 88 stop_time_ = OS::Ticks(); |
| 79 | 89 |
| 80 // Compute the delta between start and stop, in milliseconds. | 90 // Compute the delta between start and stop, in milliseconds. |
| 81 int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; | 91 int milliseconds = static_cast<int>(stop_time_ - start_time_) / 1000; |
| 82 Isolate::Current()->stats_table()-> | 92 histogram_.AddSample(milliseconds); |
| 83 AddHistogramSample(histogram_, milliseconds); | |
| 84 } | 93 } |
| 85 } | 94 } |
| 86 | 95 |
| 87 | |
| 88 void* HistogramTimer::CreateHistogram() const { | |
| 89 return Isolate::Current()->stats_table()-> | |
| 90 CreateHistogram(name_, 0, 10000, 50); | |
| 91 } | |
| 92 | |
| 93 } } // namespace v8::internal | 96 } } // namespace v8::internal |
| OLD | NEW |