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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "counters.h" | 7 #include "counters.h" |
8 #include "isolate.h" | 8 #include "isolate.h" |
9 #include "platform.h" | 9 #include "platform.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Stop the timer and record the results. | 46 // Stop the timer and record the results. |
47 void HistogramTimer::Stop() { | 47 void HistogramTimer::Stop() { |
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 |
| 57 Counters::Counters(Isolate* isolate) { |
| 58 #define HT(name, caption) \ |
| 59 name##_ = HistogramTimer(#caption, 0, 10000, 50, isolate); |
| 60 HISTOGRAM_TIMER_LIST(HT) |
| 61 #undef HT |
| 62 |
| 63 #define HP(name, caption) \ |
| 64 name##_ = Histogram(#caption, 0, 101, 100, isolate); |
| 65 HISTOGRAM_PERCENTAGE_LIST(HP) |
| 66 #undef HP |
| 67 |
| 68 #define HM(name, caption) \ |
| 69 name##_ = Histogram(#caption, 1000, 500000, 50, isolate); |
| 70 HISTOGRAM_MEMORY_LIST(HM) |
| 71 #undef HM |
| 72 |
| 73 #define SC(name, caption) \ |
| 74 name##_ = StatsCounter(isolate, "c:" #caption); |
| 75 |
| 76 STATS_COUNTER_LIST_1(SC) |
| 77 STATS_COUNTER_LIST_2(SC) |
| 78 #undef SC |
| 79 |
| 80 #define SC(name) \ |
| 81 count_of_##name##_ = StatsCounter(isolate, "c:" "V8.CountOf_" #name); \ |
| 82 size_of_##name##_ = StatsCounter(isolate, "c:" "V8.SizeOf_" #name); |
| 83 INSTANCE_TYPE_LIST(SC) |
| 84 #undef SC |
| 85 |
| 86 #define SC(name) \ |
| 87 count_of_CODE_TYPE_##name##_ = \ |
| 88 StatsCounter(isolate, "c:" "V8.CountOf_CODE_TYPE-" #name); \ |
| 89 size_of_CODE_TYPE_##name##_ = \ |
| 90 StatsCounter(isolate, "c:" "V8.SizeOf_CODE_TYPE-" #name); |
| 91 CODE_KIND_LIST(SC) |
| 92 #undef SC |
| 93 |
| 94 #define SC(name) \ |
| 95 count_of_FIXED_ARRAY_##name##_ = \ |
| 96 StatsCounter(isolate, "c:" "V8.CountOf_FIXED_ARRAY-" #name); \ |
| 97 size_of_FIXED_ARRAY_##name##_ = \ |
| 98 StatsCounter(isolate, "c:" "V8.SizeOf_FIXED_ARRAY-" #name); |
| 99 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC) |
| 100 #undef SC |
| 101 |
| 102 #define SC(name) \ |
| 103 count_of_CODE_AGE_##name##_ = \ |
| 104 StatsCounter(isolate, "c:" "V8.CountOf_CODE_AGE-" #name); \ |
| 105 size_of_CODE_AGE_##name##_ = \ |
| 106 StatsCounter(isolate, "c:" "V8.SizeOf_CODE_AGE-" #name); |
| 107 CODE_AGE_LIST_COMPLETE(SC) |
| 108 #undef SC |
| 109 } |
| 110 |
| 111 |
| 112 void Counters::ResetHistograms() { |
| 113 #define HT(name, caption) name##_.Reset(); |
| 114 HISTOGRAM_TIMER_LIST(HT) |
| 115 #undef HT |
| 116 |
| 117 #define HP(name, caption) name##_.Reset(); |
| 118 HISTOGRAM_PERCENTAGE_LIST(HP) |
| 119 #undef HP |
| 120 |
| 121 #define HM(name, caption) name##_.Reset(); |
| 122 HISTOGRAM_MEMORY_LIST(HM) |
| 123 #undef HM |
| 124 } |
| 125 |
56 } } // namespace v8::internal | 126 } } // namespace v8::internal |
OLD | NEW |