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

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

Issue 272433002: Merge counters and v8-counters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_V8_COUNTERS_H_
6 #define V8_V8_COUNTERS_H_
7
8 #include "allocation.h"
9 #include "counters.h"
10 #include "objects.h"
11 #include "v8globals.h"
12
13 namespace v8 {
14 namespace internal {
15
16 #define HISTOGRAM_TIMER_LIST(HT) \
17 /* Garbage collection timers. */ \
18 HT(gc_compactor, V8.GCCompactor) \
19 HT(gc_scavenger, V8.GCScavenger) \
20 HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
21 /* Parsing timers. */ \
22 HT(parse, V8.Parse) \
23 HT(parse_lazy, V8.ParseLazy) \
24 HT(pre_parse, V8.PreParse) \
25 /* Total compilation times. */ \
26 HT(compile, V8.Compile) \
27 HT(compile_eval, V8.CompileEval) \
28 HT(compile_lazy, V8.CompileLazy)
29
30 #define HISTOGRAM_PERCENTAGE_LIST(HP) \
31 /* Heap fragmentation. */ \
32 HP(external_fragmentation_total, \
33 V8.MemoryExternalFragmentationTotal) \
34 HP(external_fragmentation_old_pointer_space, \
35 V8.MemoryExternalFragmentationOldPointerSpace) \
36 HP(external_fragmentation_old_data_space, \
37 V8.MemoryExternalFragmentationOldDataSpace) \
38 HP(external_fragmentation_code_space, \
39 V8.MemoryExternalFragmentationCodeSpace) \
40 HP(external_fragmentation_map_space, \
41 V8.MemoryExternalFragmentationMapSpace) \
42 HP(external_fragmentation_cell_space, \
43 V8.MemoryExternalFragmentationCellSpace) \
44 HP(external_fragmentation_property_cell_space, \
45 V8.MemoryExternalFragmentationPropertyCellSpace) \
46 HP(external_fragmentation_lo_space, \
47 V8.MemoryExternalFragmentationLoSpace) \
48 /* Percentages of heap committed to each space. */ \
49 HP(heap_fraction_new_space, \
50 V8.MemoryHeapFractionNewSpace) \
51 HP(heap_fraction_old_pointer_space, \
52 V8.MemoryHeapFractionOldPointerSpace) \
53 HP(heap_fraction_old_data_space, \
54 V8.MemoryHeapFractionOldDataSpace) \
55 HP(heap_fraction_code_space, \
56 V8.MemoryHeapFractionCodeSpace) \
57 HP(heap_fraction_map_space, \
58 V8.MemoryHeapFractionMapSpace) \
59 HP(heap_fraction_cell_space, \
60 V8.MemoryHeapFractionCellSpace) \
61 HP(heap_fraction_property_cell_space, \
62 V8.MemoryHeapFractionPropertyCellSpace) \
63 HP(heap_fraction_lo_space, \
64 V8.MemoryHeapFractionLoSpace) \
65 /* Percentage of crankshafted codegen. */ \
66 HP(codegen_fraction_crankshaft, \
67 V8.CodegenFractionCrankshaft) \
68
69
70 #define HISTOGRAM_MEMORY_LIST(HM) \
71 HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted) \
72 HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed) \
73 HM(heap_sample_map_space_committed, \
74 V8.MemoryHeapSampleMapSpaceCommitted) \
75 HM(heap_sample_cell_space_committed, \
76 V8.MemoryHeapSampleCellSpaceCommitted) \
77 HM(heap_sample_property_cell_space_committed, \
78 V8.MemoryHeapSamplePropertyCellSpaceCommitted) \
79 HM(heap_sample_code_space_committed, \
80 V8.MemoryHeapSampleCodeSpaceCommitted) \
81 HM(heap_sample_maximum_committed, \
82 V8.MemoryHeapSampleMaximumCommitted) \
83
84
85 // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
86 // Intellisense to crash. It was broken into two macros (each of length 40
87 // lines) rather than one macro (of length about 80 lines) to work around
88 // this problem. Please avoid using recursive macros of this length when
89 // possible.
90 #define STATS_COUNTER_LIST_1(SC) \
91 /* Global Handle Count*/ \
92 SC(global_handles, V8.GlobalHandles) \
93 /* OS Memory allocated */ \
94 SC(memory_allocated, V8.OsMemoryAllocated) \
95 SC(normalized_maps, V8.NormalizedMaps) \
96 SC(props_to_dictionary, V8.ObjectPropertiesToDictionary) \
97 SC(elements_to_dictionary, V8.ObjectElementsToDictionary) \
98 SC(alive_after_last_gc, V8.AliveAfterLastGC) \
99 SC(objs_since_last_young, V8.ObjsSinceLastYoung) \
100 SC(objs_since_last_full, V8.ObjsSinceLastFull) \
101 SC(string_table_capacity, V8.StringTableCapacity) \
102 SC(number_of_symbols, V8.NumberOfSymbols) \
103 SC(script_wrappers, V8.ScriptWrappers) \
104 SC(call_initialize_stubs, V8.CallInitializeStubs) \
105 SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs) \
106 SC(call_normal_stubs, V8.CallNormalStubs) \
107 SC(call_megamorphic_stubs, V8.CallMegamorphicStubs) \
108 SC(arguments_adaptors, V8.ArgumentsAdaptors) \
109 SC(compilation_cache_hits, V8.CompilationCacheHits) \
110 SC(compilation_cache_misses, V8.CompilationCacheMisses) \
111 SC(string_ctor_calls, V8.StringConstructorCalls) \
112 SC(string_ctor_conversions, V8.StringConstructorConversions) \
113 SC(string_ctor_cached_number, V8.StringConstructorCachedNumber) \
114 SC(string_ctor_string_value, V8.StringConstructorStringValue) \
115 SC(string_ctor_gc_required, V8.StringConstructorGCRequired) \
116 /* Amount of evaled source code. */ \
117 SC(total_eval_size, V8.TotalEvalSize) \
118 /* Amount of loaded source code. */ \
119 SC(total_load_size, V8.TotalLoadSize) \
120 /* Amount of parsed source code. */ \
121 SC(total_parse_size, V8.TotalParseSize) \
122 /* Amount of source code skipped over using preparsing. */ \
123 SC(total_preparse_skipped, V8.TotalPreparseSkipped) \
124 /* Number of symbol lookups skipped using preparsing */ \
125 SC(total_preparse_symbols_skipped, V8.TotalPreparseSymbolSkipped) \
126 /* Amount of compiled source code. */ \
127 SC(total_compile_size, V8.TotalCompileSize) \
128 /* Amount of source code compiled with the full codegen. */ \
129 SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \
130 /* Number of contexts created from scratch. */ \
131 SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \
132 /* Number of contexts created by partial snapshot. */ \
133 SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot) \
134 /* Number of code objects found from pc. */ \
135 SC(pc_to_code, V8.PcToCode) \
136 SC(pc_to_code_cached, V8.PcToCodeCached) \
137 /* The store-buffer implementation of the write barrier. */ \
138 SC(store_buffer_compactions, V8.StoreBufferCompactions) \
139 SC(store_buffer_overflows, V8.StoreBufferOverflows)
140
141
142 #define STATS_COUNTER_LIST_2(SC) \
143 /* Number of code stubs. */ \
144 SC(code_stubs, V8.CodeStubs) \
145 /* Amount of stub code. */ \
146 SC(total_stubs_code_size, V8.TotalStubsCodeSize) \
147 /* Amount of (JS) compiled code. */ \
148 SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \
149 SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \
150 SC(gc_compactor_caused_by_promoted_data, \
151 V8.GCCompactorCausedByPromotedData) \
152 SC(gc_compactor_caused_by_oldspace_exhaustion, \
153 V8.GCCompactorCausedByOldspaceExhaustion) \
154 SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \
155 SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \
156 /* How is the generic keyed-load stub used? */ \
157 SC(keyed_load_generic_smi, V8.KeyedLoadGenericSmi) \
158 SC(keyed_load_generic_symbol, V8.KeyedLoadGenericSymbol) \
159 SC(keyed_load_generic_lookup_cache, V8.KeyedLoadGenericLookupCache) \
160 SC(keyed_load_generic_slow, V8.KeyedLoadGenericSlow) \
161 SC(keyed_load_polymorphic_stubs, V8.KeyedLoadPolymorphicStubs) \
162 SC(keyed_load_external_array_slow, V8.KeyedLoadExternalArraySlow) \
163 /* How is the generic keyed-call stub used? */ \
164 SC(keyed_call_generic_smi_fast, V8.KeyedCallGenericSmiFast) \
165 SC(keyed_call_generic_smi_dict, V8.KeyedCallGenericSmiDict) \
166 SC(keyed_call_generic_lookup_cache, V8.KeyedCallGenericLookupCache) \
167 SC(keyed_call_generic_lookup_dict, V8.KeyedCallGenericLookupDict) \
168 SC(keyed_call_generic_slow, V8.KeyedCallGenericSlow) \
169 SC(keyed_call_generic_slow_load, V8.KeyedCallGenericSlowLoad) \
170 SC(named_load_global_stub, V8.NamedLoadGlobalStub) \
171 SC(named_store_global_inline, V8.NamedStoreGlobalInline) \
172 SC(named_store_global_inline_miss, V8.NamedStoreGlobalInlineMiss) \
173 SC(keyed_store_polymorphic_stubs, V8.KeyedStorePolymorphicStubs) \
174 SC(keyed_store_external_array_slow, V8.KeyedStoreExternalArraySlow) \
175 SC(store_normal_miss, V8.StoreNormalMiss) \
176 SC(store_normal_hit, V8.StoreNormalHit) \
177 SC(cow_arrays_created_stub, V8.COWArraysCreatedStub) \
178 SC(cow_arrays_created_runtime, V8.COWArraysCreatedRuntime) \
179 SC(cow_arrays_converted, V8.COWArraysConverted) \
180 SC(call_miss, V8.CallMiss) \
181 SC(keyed_call_miss, V8.KeyedCallMiss) \
182 SC(load_miss, V8.LoadMiss) \
183 SC(keyed_load_miss, V8.KeyedLoadMiss) \
184 SC(call_const, V8.CallConst) \
185 SC(call_const_fast_api, V8.CallConstFastApi) \
186 SC(call_const_interceptor, V8.CallConstInterceptor) \
187 SC(call_const_interceptor_fast_api, V8.CallConstInterceptorFastApi) \
188 SC(call_global_inline, V8.CallGlobalInline) \
189 SC(call_global_inline_miss, V8.CallGlobalInlineMiss) \
190 SC(constructed_objects, V8.ConstructedObjects) \
191 SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \
192 SC(negative_lookups, V8.NegativeLookups) \
193 SC(negative_lookups_miss, V8.NegativeLookupsMiss) \
194 SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes) \
195 SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses) \
196 SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates) \
197 SC(array_function_runtime, V8.ArrayFunctionRuntime) \
198 SC(array_function_native, V8.ArrayFunctionNative) \
199 SC(for_in, V8.ForIn) \
200 SC(enum_cache_hits, V8.EnumCacheHits) \
201 SC(enum_cache_misses, V8.EnumCacheMisses) \
202 SC(zone_segment_bytes, V8.ZoneSegmentBytes) \
203 SC(fast_new_closure_total, V8.FastNewClosureTotal) \
204 SC(fast_new_closure_try_optimized, V8.FastNewClosureTryOptimized) \
205 SC(fast_new_closure_install_optimized, V8.FastNewClosureInstallOptimized) \
206 SC(string_add_runtime, V8.StringAddRuntime) \
207 SC(string_add_native, V8.StringAddNative) \
208 SC(string_add_runtime_ext_to_ascii, V8.StringAddRuntimeExtToAscii) \
209 SC(sub_string_runtime, V8.SubStringRuntime) \
210 SC(sub_string_native, V8.SubStringNative) \
211 SC(string_add_make_two_char, V8.StringAddMakeTwoChar) \
212 SC(string_compare_native, V8.StringCompareNative) \
213 SC(string_compare_runtime, V8.StringCompareRuntime) \
214 SC(regexp_entry_runtime, V8.RegExpEntryRuntime) \
215 SC(regexp_entry_native, V8.RegExpEntryNative) \
216 SC(number_to_string_native, V8.NumberToStringNative) \
217 SC(number_to_string_runtime, V8.NumberToStringRuntime) \
218 SC(math_acos, V8.MathAcos) \
219 SC(math_asin, V8.MathAsin) \
220 SC(math_atan, V8.MathAtan) \
221 SC(math_atan2, V8.MathAtan2) \
222 SC(math_exp, V8.MathExp) \
223 SC(math_floor, V8.MathFloor) \
224 SC(math_log, V8.MathLog) \
225 SC(math_pow, V8.MathPow) \
226 SC(math_round, V8.MathRound) \
227 SC(math_sqrt, V8.MathSqrt) \
228 SC(stack_interrupts, V8.StackInterrupts) \
229 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \
230 SC(bounds_checks_eliminated, V8.BoundsChecksEliminated) \
231 SC(bounds_checks_hoisted, V8.BoundsChecksHoisted) \
232 SC(soft_deopts_requested, V8.SoftDeoptsRequested) \
233 SC(soft_deopts_inserted, V8.SoftDeoptsInserted) \
234 SC(soft_deopts_executed, V8.SoftDeoptsExecuted) \
235 /* Number of write barriers in generated code. */ \
236 SC(write_barriers_dynamic, V8.WriteBarriersDynamic) \
237 SC(write_barriers_static, V8.WriteBarriersStatic) \
238 SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
239 SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
240 SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
241 SC(old_pointer_space_bytes_available, \
242 V8.MemoryOldPointerSpaceBytesAvailable) \
243 SC(old_pointer_space_bytes_committed, \
244 V8.MemoryOldPointerSpaceBytesCommitted) \
245 SC(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
246 SC(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
247 SC(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
248 SC(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
249 SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
250 SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
251 SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
252 SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
253 SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
254 SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
255 SC(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
256 SC(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
257 SC(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
258 SC(property_cell_space_bytes_available, \
259 V8.MemoryPropertyCellSpaceBytesAvailable) \
260 SC(property_cell_space_bytes_committed, \
261 V8.MemoryPropertyCellSpaceBytesCommitted) \
262 SC(property_cell_space_bytes_used, \
263 V8.MemoryPropertyCellSpaceBytesUsed) \
264 SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
265 SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
266 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
267
268
269 // This file contains all the v8 counters that are in use.
270 class Counters {
271 public:
272 #define HT(name, caption) \
273 HistogramTimer* name() { return &name##_; }
274 HISTOGRAM_TIMER_LIST(HT)
275 #undef HT
276
277 #define HP(name, caption) \
278 Histogram* name() { return &name##_; }
279 HISTOGRAM_PERCENTAGE_LIST(HP)
280 #undef HP
281
282 #define HM(name, caption) \
283 Histogram* name() { return &name##_; }
284 HISTOGRAM_MEMORY_LIST(HM)
285 #undef HM
286
287 #define SC(name, caption) \
288 StatsCounter* name() { return &name##_; }
289 STATS_COUNTER_LIST_1(SC)
290 STATS_COUNTER_LIST_2(SC)
291 #undef SC
292
293 #define SC(name) \
294 StatsCounter* count_of_##name() { return &count_of_##name##_; } \
295 StatsCounter* size_of_##name() { return &size_of_##name##_; }
296 INSTANCE_TYPE_LIST(SC)
297 #undef SC
298
299 #define SC(name) \
300 StatsCounter* count_of_CODE_TYPE_##name() \
301 { return &count_of_CODE_TYPE_##name##_; } \
302 StatsCounter* size_of_CODE_TYPE_##name() \
303 { return &size_of_CODE_TYPE_##name##_; }
304 CODE_KIND_LIST(SC)
305 #undef SC
306
307 #define SC(name) \
308 StatsCounter* count_of_FIXED_ARRAY_##name() \
309 { return &count_of_FIXED_ARRAY_##name##_; } \
310 StatsCounter* size_of_FIXED_ARRAY_##name() \
311 { return &size_of_FIXED_ARRAY_##name##_; }
312 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
313 #undef SC
314
315 #define SC(name) \
316 StatsCounter* count_of_CODE_AGE_##name() \
317 { return &count_of_CODE_AGE_##name##_; } \
318 StatsCounter* size_of_CODE_AGE_##name() \
319 { return &size_of_CODE_AGE_##name##_; }
320 CODE_AGE_LIST_COMPLETE(SC)
321 #undef SC
322
323 enum Id {
324 #define RATE_ID(name, caption) k_##name,
325 HISTOGRAM_TIMER_LIST(RATE_ID)
326 #undef RATE_ID
327 #define PERCENTAGE_ID(name, caption) k_##name,
328 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
329 #undef PERCENTAGE_ID
330 #define MEMORY_ID(name, caption) k_##name,
331 HISTOGRAM_MEMORY_LIST(MEMORY_ID)
332 #undef MEMORY_ID
333 #define COUNTER_ID(name, caption) k_##name,
334 STATS_COUNTER_LIST_1(COUNTER_ID)
335 STATS_COUNTER_LIST_2(COUNTER_ID)
336 #undef COUNTER_ID
337 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
338 INSTANCE_TYPE_LIST(COUNTER_ID)
339 #undef COUNTER_ID
340 #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
341 kSizeOfCODE_TYPE_##name,
342 CODE_KIND_LIST(COUNTER_ID)
343 #undef COUNTER_ID
344 #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \
345 kSizeOfFIXED_ARRAY__##name,
346 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
347 #undef COUNTER_ID
348 #define COUNTER_ID(name) kCountOfCODE_AGE__##name, \
349 kSizeOfCODE_AGE__##name,
350 CODE_AGE_LIST_COMPLETE(COUNTER_ID)
351 #undef COUNTER_ID
352 stats_counter_count
353 };
354
355 void ResetHistograms();
356
357 private:
358 #define HT(name, caption) \
359 HistogramTimer name##_;
360 HISTOGRAM_TIMER_LIST(HT)
361 #undef HT
362
363 #define HP(name, caption) \
364 Histogram name##_;
365 HISTOGRAM_PERCENTAGE_LIST(HP)
366 #undef HP
367
368 #define HM(name, caption) \
369 Histogram name##_;
370 HISTOGRAM_MEMORY_LIST(HM)
371 #undef HM
372
373 #define SC(name, caption) \
374 StatsCounter name##_;
375 STATS_COUNTER_LIST_1(SC)
376 STATS_COUNTER_LIST_2(SC)
377 #undef SC
378
379 #define SC(name) \
380 StatsCounter size_of_##name##_; \
381 StatsCounter count_of_##name##_;
382 INSTANCE_TYPE_LIST(SC)
383 #undef SC
384
385 #define SC(name) \
386 StatsCounter size_of_CODE_TYPE_##name##_; \
387 StatsCounter count_of_CODE_TYPE_##name##_;
388 CODE_KIND_LIST(SC)
389 #undef SC
390
391 #define SC(name) \
392 StatsCounter size_of_FIXED_ARRAY_##name##_; \
393 StatsCounter count_of_FIXED_ARRAY_##name##_;
394 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
395 #undef SC
396
397 #define SC(name) \
398 StatsCounter size_of_CODE_AGE_##name##_; \
399 StatsCounter count_of_CODE_AGE_##name##_;
400 CODE_AGE_LIST_COMPLETE(SC)
401 #undef SC
402
403 friend class Isolate;
404
405 explicit Counters(Isolate* isolate);
406
407 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
408 };
409
410 } } // namespace v8::internal
411
412 #endif // V8_V8_COUNTERS_H_
OLDNEW
« src/store-buffer.cc ('K') | « src/store-buffer.cc ('k') | src/v8-counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698