OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. |
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 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 SC(reloc_info_count, V8.RelocInfoCount) \ | 151 SC(reloc_info_count, V8.RelocInfoCount) \ |
152 SC(reloc_info_size, V8.RelocInfoSize) \ | 152 SC(reloc_info_size, V8.RelocInfoSize) \ |
153 SC(zone_segment_bytes, V8.ZoneSegmentBytes) \ | 153 SC(zone_segment_bytes, V8.ZoneSegmentBytes) \ |
154 SC(compute_entry_frame, V8.ComputeEntryFrame) \ | 154 SC(compute_entry_frame, V8.ComputeEntryFrame) \ |
155 SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \ | 155 SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \ |
156 SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \ | 156 SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \ |
157 SC(string_add_runtime, V8.StringAddRuntime) \ | 157 SC(string_add_runtime, V8.StringAddRuntime) \ |
158 SC(string_add_native, V8.StringAddNative) | 158 SC(string_add_native, V8.StringAddNative) |
159 | 159 |
160 // This file contains all the v8 counters that are in use. | 160 // This file contains all the v8 counters that are in use. |
161 class Counters : AllStatic { | 161 class Counters { |
162 public: | 162 public: |
163 #define HT(name, caption) \ | 163 #define HT(name, caption) \ |
164 static HistogramTimer name; | 164 HistogramTimer name; |
165 HISTOGRAM_TIMER_LIST(HT) | 165 HISTOGRAM_TIMER_LIST(HT) |
166 #undef HT | 166 #undef HT |
167 | 167 |
168 #define SC(name, caption) \ | 168 #define SC(name, caption) \ |
169 static StatsCounter name; | 169 StatsCounter name; |
170 STATS_COUNTER_LIST_1(SC) | 170 STATS_COUNTER_LIST_1(SC) |
171 STATS_COUNTER_LIST_2(SC) | 171 STATS_COUNTER_LIST_2(SC) |
172 #undef SC | 172 #undef SC |
173 | 173 |
174 enum Id { | 174 enum Id { |
175 #define RATE_ID(name, caption) k_##name, | 175 #define RATE_ID(name, caption) k_##name, |
176 HISTOGRAM_TIMER_LIST(RATE_ID) | 176 HISTOGRAM_TIMER_LIST(RATE_ID) |
177 #undef RATE_ID | 177 #undef RATE_ID |
178 #define COUNTER_ID(name, caption) k_##name, | 178 #define COUNTER_ID(name, caption) k_##name, |
179 STATS_COUNTER_LIST_1(COUNTER_ID) | 179 STATS_COUNTER_LIST_1(COUNTER_ID) |
180 STATS_COUNTER_LIST_2(COUNTER_ID) | 180 STATS_COUNTER_LIST_2(COUNTER_ID) |
181 #undef COUNTER_ID | 181 #undef COUNTER_ID |
182 #define COUNTER_ID(name) k_##name, | 182 #define COUNTER_ID(name) k_##name, |
183 STATE_TAG_LIST(COUNTER_ID) | 183 STATE_TAG_LIST(COUNTER_ID) |
184 #undef COUNTER_ID | 184 #undef COUNTER_ID |
185 stats_counter_count | 185 stats_counter_count |
186 }; | 186 }; |
187 | 187 |
188 // Sliding state window counters. | 188 // Sliding state window counters. |
189 static StatsCounter state_counters[]; | 189 StatsCounter* const state_counters; |
| 190 private: |
| 191 Counters(); |
| 192 friend class V8Context; |
| 193 DISALLOW_COPY_AND_ASSIGN(Counters); |
190 }; | 194 }; |
191 | 195 |
| 196 #define COUNTER(name) v8::v8_context()->counters_.name |
| 197 #define INC_COUNTER(name) COUNTER(name).Increment() |
| 198 #define DEC_COUNTER(name) COUNTER(name).Decrement() |
| 199 #define INCREMENT_COUNTER(name, amount) COUNTER(name).Increment(amount) |
| 200 #define DECREMENT_COUNTER(name, amount) COUNTER(name).Decrement(amount) |
192 } } // namespace v8::internal | 201 } } // namespace v8::internal |
193 | 202 |
194 #endif // V8_V8_COUNTERS_H_ | 203 #endif // V8_V8_COUNTERS_H_ |
OLD | NEW |