Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/v8-counters.h

Issue 10695056: Factor out a Histogram class from HistogramTimer, and use it to measure external fragmentation (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
Michael Starzinger 2012/07/02 21:09:56 2012
jochen (gone - plz use gerrit) 2012/07/13 09:48:08 Done.
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
11 // with the distribution. 11 // with the distribution.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /* Parsing timers. */ \ 43 /* Parsing timers. */ \
44 HT(parse, V8.Parse) \ 44 HT(parse, V8.Parse) \
45 HT(parse_lazy, V8.ParseLazy) \ 45 HT(parse_lazy, V8.ParseLazy) \
46 HT(pre_parse, V8.PreParse) \ 46 HT(pre_parse, V8.PreParse) \
47 /* Total compilation times. */ \ 47 /* Total compilation times. */ \
48 HT(compile, V8.Compile) \ 48 HT(compile, V8.Compile) \
49 HT(compile_eval, V8.CompileEval) \ 49 HT(compile_eval, V8.CompileEval) \
50 HT(compile_lazy, V8.CompileLazy) 50 HT(compile_lazy, V8.CompileLazy)
51 51
52 52
53 #define HISTOGRAM_MEMORY_LIST(HM) \
54 HM(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
55 HM(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
56 HM(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
57 HM(old_pointer_space_bytes_available, \
58 V8.MemoryOldPointerSpaceBytesAvailable) \
59 HM(old_pointer_space_bytes_committed, \
60 V8.MemoryOldPointerSpaceBytesCommitted) \
61 HM(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
62 HM(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
63 HM(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
64 HM(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
65 HM(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
66 HM(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
67 HM(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
68 HM(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
69 HM(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
70 HM(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
71 HM(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
72 HM(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
73 HM(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
74 HM(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
75 HM(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
76 HM(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
77
78
53 // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC 79 // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
54 // Intellisense to crash. It was broken into two macros (each of length 40 80 // Intellisense to crash. It was broken into two macros (each of length 40
55 // lines) rather than one macro (of length about 80 lines) to work around 81 // lines) rather than one macro (of length about 80 lines) to work around
56 // this problem. Please avoid using recursive macros of this length when 82 // this problem. Please avoid using recursive macros of this length when
57 // possible. 83 // possible.
58 #define STATS_COUNTER_LIST_1(SC) \ 84 #define STATS_COUNTER_LIST_1(SC) \
59 /* Global Handle Count*/ \ 85 /* Global Handle Count*/ \
60 SC(global_handles, V8.GlobalHandles) \ 86 SC(global_handles, V8.GlobalHandles) \
61 /* Mallocs from PCRE */ \ 87 /* Mallocs from PCRE */ \
62 SC(pcre_mallocs, V8.PcreMallocCount) \ 88 SC(pcre_mallocs, V8.PcreMallocCount) \
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 SC(math_sin, V8.MathSin) \ 265 SC(math_sin, V8.MathSin) \
240 SC(math_sqrt, V8.MathSqrt) \ 266 SC(math_sqrt, V8.MathSqrt) \
241 SC(math_tan, V8.MathTan) \ 267 SC(math_tan, V8.MathTan) \
242 SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \ 268 SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \
243 SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) \ 269 SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) \
244 SC(stack_interrupts, V8.StackInterrupts) \ 270 SC(stack_interrupts, V8.StackInterrupts) \
245 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \ 271 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \
246 SC(smi_checks_removed, V8.SmiChecksRemoved) \ 272 SC(smi_checks_removed, V8.SmiChecksRemoved) \
247 SC(map_checks_removed, V8.MapChecksRemoved) \ 273 SC(map_checks_removed, V8.MapChecksRemoved) \
248 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \ 274 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \
249 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) \ 275 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount)
250 SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
251 SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
252 SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
253 SC(old_pointer_space_bytes_available, \
254 V8.MemoryOldPointerSpaceBytesAvailable) \
255 SC(old_pointer_space_bytes_committed, \
256 V8.MemoryOldPointerSpaceBytesCommitted) \
257 SC(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
258 SC(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
259 SC(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
260 SC(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
261 SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
262 SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
263 SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
264 SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
265 SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
266 SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
267 SC(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
268 SC(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
269 SC(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
270 SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
271 SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
272 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
273 276
274 277
275 // This file contains all the v8 counters that are in use. 278 // This file contains all the v8 counters that are in use.
276 class Counters { 279 class Counters {
277 public: 280 public:
278 #define HT(name, caption) \ 281 #define HT(name, caption) \
279 HistogramTimer* name() { return &name##_; } 282 HistogramTimer* name() { return &name##_; }
280 HISTOGRAM_TIMER_LIST(HT) 283 HISTOGRAM_TIMER_LIST(HT)
281 #undef HT 284 #undef HT
282 285
286 #define HM(name, caption) \
287 Histogram* name() { return &name##_; }
288 HISTOGRAM_MEMORY_LIST(HM)
289 #undef HM
290
283 #define SC(name, caption) \ 291 #define SC(name, caption) \
284 StatsCounter* name() { return &name##_; } 292 StatsCounter* name() { return &name##_; }
285 STATS_COUNTER_LIST_1(SC) 293 STATS_COUNTER_LIST_1(SC)
286 STATS_COUNTER_LIST_2(SC) 294 STATS_COUNTER_LIST_2(SC)
287 #undef SC 295 #undef SC
288 296
289 enum Id { 297 enum Id {
290 #define RATE_ID(name, caption) k_##name, 298 #define RATE_ID(name, caption) k_##name,
291 HISTOGRAM_TIMER_LIST(RATE_ID) 299 HISTOGRAM_TIMER_LIST(RATE_ID)
292 #undef RATE_ID 300 #undef RATE_ID
301 #define MEMORY_ID(name, caption) k_##name,
302 HISTOGRAM_MEMORY_LIST(MEMORY_ID)
303 #undef MEMORY_ID
293 #define COUNTER_ID(name, caption) k_##name, 304 #define COUNTER_ID(name, caption) k_##name,
294 STATS_COUNTER_LIST_1(COUNTER_ID) 305 STATS_COUNTER_LIST_1(COUNTER_ID)
295 STATS_COUNTER_LIST_2(COUNTER_ID) 306 STATS_COUNTER_LIST_2(COUNTER_ID)
296 #undef COUNTER_ID 307 #undef COUNTER_ID
297 #define COUNTER_ID(name) k_##name, 308 #define COUNTER_ID(name) k_##name,
298 STATE_TAG_LIST(COUNTER_ID) 309 STATE_TAG_LIST(COUNTER_ID)
299 #undef COUNTER_ID 310 #undef COUNTER_ID
300 stats_counter_count 311 stats_counter_count
301 }; 312 };
302 313
303 StatsCounter* state_counters(StateTag state) { 314 StatsCounter* state_counters(StateTag state) {
304 return &state_counters_[state]; 315 return &state_counters_[state];
305 } 316 }
306 317
307 private: 318 private:
308 #define HT(name, caption) \ 319 #define HT(name, caption) \
309 HistogramTimer name##_; 320 HistogramTimer name##_;
310 HISTOGRAM_TIMER_LIST(HT) 321 HISTOGRAM_TIMER_LIST(HT)
311 #undef HT 322 #undef HT
312 323
324 #define HM(name, caption) \
325 Histogram name##_;
326 HISTOGRAM_MEMORY_LIST(HM)
327 #undef HM
328
313 #define SC(name, caption) \ 329 #define SC(name, caption) \
314 StatsCounter name##_; 330 StatsCounter name##_;
315 STATS_COUNTER_LIST_1(SC) 331 STATS_COUNTER_LIST_1(SC)
316 STATS_COUNTER_LIST_2(SC) 332 STATS_COUNTER_LIST_2(SC)
317 #undef SC 333 #undef SC
318 334
319 enum { 335 enum {
320 #define COUNTER_ID(name) __##name, 336 #define COUNTER_ID(name) __##name,
321 STATE_TAG_LIST(COUNTER_ID) 337 STATE_TAG_LIST(COUNTER_ID)
322 #undef COUNTER_ID 338 #undef COUNTER_ID
323 kSlidingStateWindowCounterCount 339 kSlidingStateWindowCounterCount
324 }; 340 };
325 341
326 // Sliding state window counters. 342 // Sliding state window counters.
327 StatsCounter state_counters_[kSlidingStateWindowCounterCount]; 343 StatsCounter state_counters_[kSlidingStateWindowCounterCount];
328 friend class Isolate; 344 friend class Isolate;
329 345
330 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 346 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
331 }; 347 };
332 348
333 } } // namespace v8::internal 349 } } // namespace v8::internal
334 350
335 #endif // V8_V8_COUNTERS_H_ 351 #endif // V8_V8_COUNTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698