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 #include "src/log-inl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (Enabled()) { | 40 if (Enabled()) { |
41 timer_.Start(); | 41 timer_.Start(); |
42 } | 42 } |
43 Logger::CallEventLogger(isolate(), name(), Logger::START, true); | 43 Logger::CallEventLogger(isolate(), name(), Logger::START, true); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 // Stop the timer and record the results. | 47 // Stop the timer and record the results. |
48 void HistogramTimer::Stop() { | 48 void HistogramTimer::Stop() { |
49 if (Enabled()) { | 49 if (Enabled()) { |
50 // Compute the delta between start and stop, in milliseconds. | 50 int64_t sample = resolution_ == MICROSECOND |
51 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); | 51 ? timer_.Elapsed().InMicroseconds() |
| 52 : timer_.Elapsed().InMilliseconds(); |
| 53 // Compute the delta between start and stop, in microseconds. |
| 54 AddSample(static_cast<int>(sample)); |
52 timer_.Stop(); | 55 timer_.Stop(); |
53 } | 56 } |
54 Logger::CallEventLogger(isolate(), name(), Logger::END, true); | 57 Logger::CallEventLogger(isolate(), name(), Logger::END, true); |
55 } | 58 } |
56 | 59 |
57 | 60 |
58 Counters::Counters(Isolate* isolate) { | 61 Counters::Counters(Isolate* isolate) { |
59 #define HR(name, caption, min, max, num_buckets) \ | 62 #define HR(name, caption, min, max, num_buckets) \ |
60 name##_ = Histogram(#caption, min, max, num_buckets, isolate); | 63 name##_ = Histogram(#caption, min, max, num_buckets, isolate); |
61 HISTOGRAM_RANGE_LIST(HR) | 64 HISTOGRAM_RANGE_LIST(HR) |
62 #undef HR | 65 #undef HR |
63 | 66 |
64 #define HT(name, caption) \ | 67 #define HT(name, caption, max, res) \ |
65 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); | 68 name##_ = HistogramTimer(#caption, 0, max, HistogramTimer::res, 50, isolate); |
66 HISTOGRAM_TIMER_LIST(HT) | 69 HISTOGRAM_TIMER_LIST(HT) |
67 #undef HT | 70 #undef HT |
68 | 71 |
69 #define AHT(name, caption) \ | 72 #define AHT(name, caption) \ |
70 name##_ = AggregatableHistogramTimer(#caption, 0, 10000, 50, isolate); | 73 name##_ = AggregatableHistogramTimer(#caption, 0, 10000000, 50, isolate); |
71 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) | 74 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) |
72 #undef AHT | 75 #undef AHT |
73 | 76 |
74 #define HP(name, caption) \ | 77 #define HP(name, caption) \ |
75 name##_ = Histogram(#caption, 0, 101, 100, isolate); | 78 name##_ = Histogram(#caption, 0, 101, 100, isolate); |
76 HISTOGRAM_PERCENTAGE_LIST(HP) | 79 HISTOGRAM_PERCENTAGE_LIST(HP) |
77 #undef HP | 80 #undef HP |
78 | 81 |
79 #define HM(name, caption) \ | 82 #define HM(name, caption) \ |
80 name##_ = Histogram(#caption, 1000, 500000, 50, isolate); | 83 name##_ = Histogram(#caption, 1000, 500000, 50, isolate); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 CODE_AGE_LIST_COMPLETE(SC) | 153 CODE_AGE_LIST_COMPLETE(SC) |
151 #undef SC | 154 #undef SC |
152 } | 155 } |
153 | 156 |
154 | 157 |
155 void Counters::ResetHistograms() { | 158 void Counters::ResetHistograms() { |
156 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); | 159 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); |
157 HISTOGRAM_RANGE_LIST(HR) | 160 HISTOGRAM_RANGE_LIST(HR) |
158 #undef HR | 161 #undef HR |
159 | 162 |
160 #define HT(name, caption) name##_.Reset(); | 163 #define HT(name, caption, max, res) name##_.Reset(); |
161 HISTOGRAM_TIMER_LIST(HT) | 164 HISTOGRAM_TIMER_LIST(HT) |
162 #undef HT | 165 #undef HT |
163 | 166 |
164 #define AHT(name, caption) name##_.Reset(); | 167 #define AHT(name, caption) name##_.Reset(); |
165 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) | 168 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) |
166 #undef AHT | 169 #undef AHT |
167 | 170 |
168 #define HP(name, caption) name##_.Reset(); | 171 #define HP(name, caption) name##_.Reset(); |
169 HISTOGRAM_PERCENTAGE_LIST(HP) | 172 HISTOGRAM_PERCENTAGE_LIST(HP) |
170 #undef HP | 173 #undef HP |
171 | 174 |
172 #define HM(name, caption) name##_.Reset(); | 175 #define HM(name, caption) name##_.Reset(); |
173 HISTOGRAM_MEMORY_LIST(HM) | 176 HISTOGRAM_MEMORY_LIST(HM) |
174 #undef HM | 177 #undef HM |
175 } | 178 } |
176 | 179 |
177 } } // namespace v8::internal | 180 } } // namespace v8::internal |
OLD | NEW |