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 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (Enabled()) { | 48 if (Enabled()) { |
49 // Compute the delta between start and stop, in milliseconds. | 49 // Compute the delta between start and stop, in milliseconds. |
50 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); | 50 AddSample(static_cast<int>(timer_.Elapsed().InMilliseconds())); |
51 timer_.Stop(); | 51 timer_.Stop(); |
52 } | 52 } |
53 isolate()->event_logger()(name(), Logger::END); | 53 isolate()->event_logger()(name(), Logger::END); |
54 } | 54 } |
55 | 55 |
56 | 56 |
57 Counters::Counters(Isolate* isolate) { | 57 Counters::Counters(Isolate* isolate) { |
| 58 #define HR(name, caption, min, max, num_buckets) \ |
| 59 name##_ = Histogram(#caption, min, max, num_buckets, isolate); |
| 60 HISTOGRAM_RANGE_LIST(HR) |
| 61 #undef HR |
| 62 |
58 #define HT(name, caption) \ | 63 #define HT(name, caption) \ |
59 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); | 64 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); |
60 HISTOGRAM_TIMER_LIST(HT) | 65 HISTOGRAM_TIMER_LIST(HT) |
61 #undef HT | 66 #undef HT |
62 | 67 |
63 #define HP(name, caption) \ | 68 #define HP(name, caption) \ |
64 name##_ = Histogram(#caption, 0, 101, 100, isolate); | 69 name##_ = Histogram(#caption, 0, 101, 100, isolate); |
65 HISTOGRAM_PERCENTAGE_LIST(HP) | 70 HISTOGRAM_PERCENTAGE_LIST(HP) |
66 #undef HP | 71 #undef HP |
67 | 72 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 140 |
136 #define SC(name) \ | 141 #define SC(name) \ |
137 count_of_CODE_AGE_##name##_.Reset(); \ | 142 count_of_CODE_AGE_##name##_.Reset(); \ |
138 size_of_CODE_AGE_##name##_.Reset(); | 143 size_of_CODE_AGE_##name##_.Reset(); |
139 CODE_AGE_LIST_COMPLETE(SC) | 144 CODE_AGE_LIST_COMPLETE(SC) |
140 #undef SC | 145 #undef SC |
141 } | 146 } |
142 | 147 |
143 | 148 |
144 void Counters::ResetHistograms() { | 149 void Counters::ResetHistograms() { |
| 150 #define HR(name, caption, min, max, num_buckets) name##_.Reset(); |
| 151 HISTOGRAM_RANGE_LIST(HR) |
| 152 #undef HR |
| 153 |
145 #define HT(name, caption) name##_.Reset(); | 154 #define HT(name, caption) name##_.Reset(); |
146 HISTOGRAM_TIMER_LIST(HT) | 155 HISTOGRAM_TIMER_LIST(HT) |
147 #undef HT | 156 #undef HT |
148 | 157 |
149 #define HP(name, caption) name##_.Reset(); | 158 #define HP(name, caption) name##_.Reset(); |
150 HISTOGRAM_PERCENTAGE_LIST(HP) | 159 HISTOGRAM_PERCENTAGE_LIST(HP) |
151 #undef HP | 160 #undef HP |
152 | 161 |
153 #define HM(name, caption) name##_.Reset(); | 162 #define HM(name, caption) name##_.Reset(); |
154 HISTOGRAM_MEMORY_LIST(HM) | 163 HISTOGRAM_MEMORY_LIST(HM) |
155 #undef HM | 164 #undef HM |
156 } | 165 } |
157 | 166 |
158 } } // namespace v8::internal | 167 } } // namespace v8::internal |
OLD | NEW |