OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 SC(js_opt_ticks, V8.JsOptTicks) \ | 247 SC(js_opt_ticks, V8.JsOptTicks) \ |
248 SC(js_non_opt_ticks, V8.JsNonoptTicks) \ | 248 SC(js_non_opt_ticks, V8.JsNonoptTicks) \ |
249 SC(js_other_ticks, V8.JsOtherTicks) \ | 249 SC(js_other_ticks, V8.JsOtherTicks) \ |
250 SC(smi_checks_removed, V8.SmiChecksRemoved) \ | 250 SC(smi_checks_removed, V8.SmiChecksRemoved) \ |
251 SC(map_checks_removed, V8.MapChecksRemoved) \ | 251 SC(map_checks_removed, V8.MapChecksRemoved) \ |
252 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \ | 252 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \ |
253 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) | 253 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) |
254 | 254 |
255 | 255 |
256 // This file contains all the v8 counters that are in use. | 256 // This file contains all the v8 counters that are in use. |
257 class Counters : AllStatic { | 257 class Counters { |
258 public: | 258 public: |
259 #define HT(name, caption) \ | 259 #define HT(name, caption) \ |
260 static HistogramTimer name; | 260 HistogramTimer* name() { return &name##_; } |
261 HISTOGRAM_TIMER_LIST(HT) | 261 HISTOGRAM_TIMER_LIST(HT) |
262 #undef HT | 262 #undef HT |
263 | 263 |
264 #define SC(name, caption) \ | 264 #define SC(name, caption) \ |
265 static StatsCounter name; | 265 StatsCounter* name() { return &name##_; } |
266 STATS_COUNTER_LIST_1(SC) | 266 STATS_COUNTER_LIST_1(SC) |
267 STATS_COUNTER_LIST_2(SC) | 267 STATS_COUNTER_LIST_2(SC) |
268 #undef SC | 268 #undef SC |
269 | 269 |
270 enum Id { | 270 enum Id { |
271 #define RATE_ID(name, caption) k_##name, | 271 #define RATE_ID(name, caption) k_##name, |
272 HISTOGRAM_TIMER_LIST(RATE_ID) | 272 HISTOGRAM_TIMER_LIST(RATE_ID) |
273 #undef RATE_ID | 273 #undef RATE_ID |
274 #define COUNTER_ID(name, caption) k_##name, | 274 #define COUNTER_ID(name, caption) k_##name, |
275 STATS_COUNTER_LIST_1(COUNTER_ID) | 275 STATS_COUNTER_LIST_1(COUNTER_ID) |
276 STATS_COUNTER_LIST_2(COUNTER_ID) | 276 STATS_COUNTER_LIST_2(COUNTER_ID) |
277 #undef COUNTER_ID | 277 #undef COUNTER_ID |
278 #define COUNTER_ID(name) k_##name, | 278 #define COUNTER_ID(name) k_##name, |
279 STATE_TAG_LIST(COUNTER_ID) | 279 STATE_TAG_LIST(COUNTER_ID) |
280 #undef COUNTER_ID | 280 #undef COUNTER_ID |
281 stats_counter_count | 281 stats_counter_count |
282 }; | 282 }; |
283 | 283 |
| 284 StatsCounter* state_counters(StateTag state) { |
| 285 return &state_counters_[state]; |
| 286 } |
| 287 |
| 288 private: |
| 289 #define HT(name, caption) \ |
| 290 HistogramTimer name##_; |
| 291 HISTOGRAM_TIMER_LIST(HT) |
| 292 #undef HT |
| 293 |
| 294 #define SC(name, caption) \ |
| 295 StatsCounter name##_; |
| 296 STATS_COUNTER_LIST_1(SC) |
| 297 STATS_COUNTER_LIST_2(SC) |
| 298 #undef SC |
| 299 |
| 300 enum { |
| 301 #define COUNTER_ID(name) __##name, |
| 302 STATE_TAG_LIST(COUNTER_ID) |
| 303 #undef COUNTER_ID |
| 304 kSlidingStateWindowCounterCount |
| 305 }; |
| 306 |
284 // Sliding state window counters. | 307 // Sliding state window counters. |
285 static StatsCounter state_counters[]; | 308 StatsCounter state_counters_[kSlidingStateWindowCounterCount]; |
| 309 friend class Isolate; |
| 310 |
| 311 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); |
286 }; | 312 }; |
287 | 313 |
| 314 #define COUNTERS Isolate::Current()->counters() |
| 315 |
288 } } // namespace v8::internal | 316 } } // namespace v8::internal |
289 | 317 |
290 #endif // V8_V8_COUNTERS_H_ | 318 #endif // V8_V8_COUNTERS_H_ |
OLD | NEW |