| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/platform/platform.h" | 7 #include "src/base/platform/platform.h" |
| 8 #include "src/counters.h" | 8 #include "src/counters.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/log-inl.h" |
| 10 | 11 |
| 11 namespace v8 { | 12 namespace v8 { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 StatsTable::StatsTable() | 15 StatsTable::StatsTable() |
| 15 : lookup_function_(NULL), | 16 : lookup_function_(NULL), |
| 16 create_histogram_function_(NULL), | 17 create_histogram_function_(NULL), |
| 17 add_histogram_sample_function_(NULL) {} | 18 add_histogram_sample_function_(NULL) {} |
| 18 | 19 |
| 19 | 20 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 return isolate()->stats_table()-> | 33 return isolate()->stats_table()-> |
| 33 CreateHistogram(name_, min_, max_, num_buckets_); | 34 CreateHistogram(name_, min_, max_, num_buckets_); |
| 34 } | 35 } |
| 35 | 36 |
| 36 | 37 |
| 37 // Start the timer. | 38 // Start the timer. |
| 38 void HistogramTimer::Start() { | 39 void HistogramTimer::Start() { |
| 39 if (Enabled()) { | 40 if (Enabled()) { |
| 40 timer_.Start(); | 41 timer_.Start(); |
| 41 } | 42 } |
| 42 isolate()->event_logger()(name(), Logger::START); | 43 Logger::CallEventLogger(isolate(), name(), Logger::START, true); |
| 43 } | 44 } |
| 44 | 45 |
| 45 | 46 |
| 46 // Stop the timer and record the results. | 47 // Stop the timer and record the results. |
| 47 void HistogramTimer::Stop() { | 48 void HistogramTimer::Stop() { |
| 48 if (Enabled()) { | 49 if (Enabled()) { |
| 49 // Compute the delta between start and stop, in milliseconds. | 50 // Compute the delta between start and stop, in milliseconds. |
| 50 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); | 51 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); |
| 51 timer_.Stop(); | 52 timer_.Stop(); |
| 52 } | 53 } |
| 53 isolate()->event_logger()(name(), Logger::END); | 54 Logger::CallEventLogger(isolate(), name(), Logger::END, true); |
| 54 } | 55 } |
| 55 | 56 |
| 56 | 57 |
| 57 Counters::Counters(Isolate* isolate) { | 58 Counters::Counters(Isolate* isolate) { |
| 58 #define HR(name, caption, min, max, num_buckets) \ | 59 #define HR(name, caption, min, max, num_buckets) \ |
| 59 name##_ = Histogram(#caption, min, max, num_buckets, isolate); | 60 name##_ = Histogram(#caption, min, max, num_buckets, isolate); |
| 60 HISTOGRAM_RANGE_LIST(HR) | 61 HISTOGRAM_RANGE_LIST(HR) |
| 61 #undef HR | 62 #undef HR |
| 62 | 63 |
| 63 #define HT(name, caption) \ | 64 #define HT(name, caption) \ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 #define HP(name, caption) name##_.Reset(); | 159 #define HP(name, caption) name##_.Reset(); |
| 159 HISTOGRAM_PERCENTAGE_LIST(HP) | 160 HISTOGRAM_PERCENTAGE_LIST(HP) |
| 160 #undef HP | 161 #undef HP |
| 161 | 162 |
| 162 #define HM(name, caption) name##_.Reset(); | 163 #define HM(name, caption) name##_.Reset(); |
| 163 HISTOGRAM_MEMORY_LIST(HM) | 164 HISTOGRAM_MEMORY_LIST(HM) |
| 164 #undef HM | 165 #undef HM |
| 165 } | 166 } |
| 166 | 167 |
| 167 } } // namespace v8::internal | 168 } } // namespace v8::internal |
| OLD | NEW |