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

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: percentages 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
« no previous file with comments | « src/heap.cc ('k') | src/v8-counters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2012 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
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_PERCENTAGE_LIST(HP) \
54 HP(external_fragmentation_new_space, \
55 V8.MemoryExternalFragmentationNewSpace) \
56 HP(external_fragmentation_old_pointer_space, \
57 V8.MemoryExternalFragmentationOldPointerSpace) \
58 HP(external_fragmentation_old_data_space, \
59 V8.MemoryExternalFragmentationOldDataSpace) \
60 HP(external_fragmentation_code_space, \
61 V8.MemoryExternalFragmentationCodeSpace) \
62 HP(external_fragmentation_map_space, \
63 V8.MemoryExternalFragmentationMapSpace) \
64 HP(external_fragmentation_cell_space, \
65 V8.MemoryExternalFragmentationCellSpace) \
66 HP(external_fragmentation_lo_space, \
67 V8.MemoryExternalFragmentationLoSpace)
68
69
53 // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC 70 // 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 71 // 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 72 // 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 73 // this problem. Please avoid using recursive macros of this length when
57 // possible. 74 // possible.
58 #define STATS_COUNTER_LIST_1(SC) \ 75 #define STATS_COUNTER_LIST_1(SC) \
59 /* Global Handle Count*/ \ 76 /* Global Handle Count*/ \
60 SC(global_handles, V8.GlobalHandles) \ 77 SC(global_handles, V8.GlobalHandles) \
61 /* Mallocs from PCRE */ \ 78 /* Mallocs from PCRE */ \
62 SC(pcre_mallocs, V8.PcreMallocCount) \ 79 SC(pcre_mallocs, V8.PcreMallocCount) \
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 290
274 291
275 // This file contains all the v8 counters that are in use. 292 // This file contains all the v8 counters that are in use.
276 class Counters { 293 class Counters {
277 public: 294 public:
278 #define HT(name, caption) \ 295 #define HT(name, caption) \
279 HistogramTimer* name() { return &name##_; } 296 HistogramTimer* name() { return &name##_; }
280 HISTOGRAM_TIMER_LIST(HT) 297 HISTOGRAM_TIMER_LIST(HT)
281 #undef HT 298 #undef HT
282 299
300 #define HP(name, caption) \
301 Histogram* name() { return &name##_; }
302 HISTOGRAM_PERCENTAGE_LIST(HP)
303 #undef HP
304
283 #define SC(name, caption) \ 305 #define SC(name, caption) \
284 StatsCounter* name() { return &name##_; } 306 StatsCounter* name() { return &name##_; }
285 STATS_COUNTER_LIST_1(SC) 307 STATS_COUNTER_LIST_1(SC)
286 STATS_COUNTER_LIST_2(SC) 308 STATS_COUNTER_LIST_2(SC)
287 #undef SC 309 #undef SC
288 310
289 enum Id { 311 enum Id {
290 #define RATE_ID(name, caption) k_##name, 312 #define RATE_ID(name, caption) k_##name,
291 HISTOGRAM_TIMER_LIST(RATE_ID) 313 HISTOGRAM_TIMER_LIST(RATE_ID)
292 #undef RATE_ID 314 #undef RATE_ID
315 #define PERCENTAGE_ID(name, caption) k_##name,
316 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
317 #undef PERCENTAGE_ID
293 #define COUNTER_ID(name, caption) k_##name, 318 #define COUNTER_ID(name, caption) k_##name,
294 STATS_COUNTER_LIST_1(COUNTER_ID) 319 STATS_COUNTER_LIST_1(COUNTER_ID)
295 STATS_COUNTER_LIST_2(COUNTER_ID) 320 STATS_COUNTER_LIST_2(COUNTER_ID)
296 #undef COUNTER_ID 321 #undef COUNTER_ID
297 #define COUNTER_ID(name) k_##name, 322 #define COUNTER_ID(name) k_##name,
298 STATE_TAG_LIST(COUNTER_ID) 323 STATE_TAG_LIST(COUNTER_ID)
299 #undef COUNTER_ID 324 #undef COUNTER_ID
300 stats_counter_count 325 stats_counter_count
301 }; 326 };
302 327
303 StatsCounter* state_counters(StateTag state) { 328 StatsCounter* state_counters(StateTag state) {
304 return &state_counters_[state]; 329 return &state_counters_[state];
305 } 330 }
306 331
307 private: 332 private:
308 #define HT(name, caption) \ 333 #define HT(name, caption) \
309 HistogramTimer name##_; 334 HistogramTimer name##_;
310 HISTOGRAM_TIMER_LIST(HT) 335 HISTOGRAM_TIMER_LIST(HT)
311 #undef HT 336 #undef HT
312 337
338 #define HP(name, caption) \
339 Histogram name##_;
340 HISTOGRAM_PERCENTAGE_LIST(HP)
341 #undef HP
342
313 #define SC(name, caption) \ 343 #define SC(name, caption) \
314 StatsCounter name##_; 344 StatsCounter name##_;
315 STATS_COUNTER_LIST_1(SC) 345 STATS_COUNTER_LIST_1(SC)
316 STATS_COUNTER_LIST_2(SC) 346 STATS_COUNTER_LIST_2(SC)
317 #undef SC 347 #undef SC
318 348
319 enum { 349 enum {
320 #define COUNTER_ID(name) __##name, 350 #define COUNTER_ID(name) __##name,
321 STATE_TAG_LIST(COUNTER_ID) 351 STATE_TAG_LIST(COUNTER_ID)
322 #undef COUNTER_ID 352 #undef COUNTER_ID
323 kSlidingStateWindowCounterCount 353 kSlidingStateWindowCounterCount
324 }; 354 };
325 355
326 // Sliding state window counters. 356 // Sliding state window counters.
327 StatsCounter state_counters_[kSlidingStateWindowCounterCount]; 357 StatsCounter state_counters_[kSlidingStateWindowCounterCount];
328 friend class Isolate; 358 friend class Isolate;
329 359
330 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 360 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
331 }; 361 };
332 362
333 } } // namespace v8::internal 363 } } // namespace v8::internal
334 364
335 #endif // V8_V8_COUNTERS_H_ 365 #endif // V8_V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/v8-counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698