blob: cb789afe1a960d86e198852177ec8dc232dcf574 [file] [log] [blame]
jkummerow@chromium.org28583c92012-07-16 11:31:55 +00001// Copyright 2012 the V8 project authors. All rights reserved.
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_V8_COUNTERS_H_
29#define V8_V8_COUNTERS_H_
30
whesse@chromium.org023421e2010-12-21 12:19:12 +000031#include "allocation.h"
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000032#include "counters.h"
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000033#include "objects.h"
whesse@chromium.org023421e2010-12-21 12:19:12 +000034#include "v8globals.h"
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000035
kasperl@chromium.org71affb52009-05-26 05:44:31 +000036namespace v8 {
37namespace internal {
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000038
kasperl@chromium.orgb3284ad2009-05-18 06:12:45 +000039#define HISTOGRAM_TIMER_LIST(HT) \
40 /* Garbage collection timers. */ \
41 HT(gc_compactor, V8.GCCompactor) \
42 HT(gc_scavenger, V8.GCScavenger) \
43 HT(gc_context, V8.GCContext) /* GC context cleanup time */ \
44 /* Parsing timers. */ \
45 HT(parse, V8.Parse) \
46 HT(parse_lazy, V8.ParseLazy) \
47 HT(pre_parse, V8.PreParse) \
48 /* Total compilation times. */ \
49 HT(compile, V8.Compile) \
50 HT(compile_eval, V8.CompileEval) \
ager@chromium.orgb61a0d12010-10-13 08:35:23 +000051 HT(compile_lazy, V8.CompileLazy)
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +000052
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000053
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000054#define HISTOGRAM_PERCENTAGE_LIST(HP) \
verwaest@chromium.org753aee42012-07-17 16:15:42 +000055 HP(external_fragmentation_total, \
56 V8.MemoryExternalFragmentationTotal) \
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000057 HP(external_fragmentation_old_pointer_space, \
58 V8.MemoryExternalFragmentationOldPointerSpace) \
59 HP(external_fragmentation_old_data_space, \
60 V8.MemoryExternalFragmentationOldDataSpace) \
61 HP(external_fragmentation_code_space, \
62 V8.MemoryExternalFragmentationCodeSpace) \
63 HP(external_fragmentation_map_space, \
64 V8.MemoryExternalFragmentationMapSpace) \
65 HP(external_fragmentation_cell_space, \
66 V8.MemoryExternalFragmentationCellSpace) \
67 HP(external_fragmentation_lo_space, \
68 V8.MemoryExternalFragmentationLoSpace)
69
70
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000071// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
72// Intellisense to crash. It was broken into two macros (each of length 40
73// lines) rather than one macro (of length about 80 lines) to work around
74// this problem. Please avoid using recursive macros of this length when
75// possible.
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +000076#define STATS_COUNTER_LIST_1(SC) \
77 /* Global Handle Count*/ \
78 SC(global_handles, V8.GlobalHandles) \
79 /* Mallocs from PCRE */ \
80 SC(pcre_mallocs, V8.PcreMallocCount) \
81 /* OS Memory allocated */ \
82 SC(memory_allocated, V8.OsMemoryAllocated) \
ricow@chromium.org65fae842010-08-25 15:26:24 +000083 SC(normalized_maps, V8.NormalizedMaps) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +000084 SC(props_to_dictionary, V8.ObjectPropertiesToDictionary) \
85 SC(elements_to_dictionary, V8.ObjectElementsToDictionary) \
86 SC(alive_after_last_gc, V8.AliveAfterLastGC) \
87 SC(objs_since_last_young, V8.ObjsSinceLastYoung) \
88 SC(objs_since_last_full, V8.ObjsSinceLastFull) \
89 SC(symbol_table_capacity, V8.SymbolTableCapacity) \
90 SC(number_of_symbols, V8.NumberOfSymbols) \
91 SC(script_wrappers, V8.ScriptWrappers) \
92 SC(call_initialize_stubs, V8.CallInitializeStubs) \
93 SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs) \
94 SC(call_normal_stubs, V8.CallNormalStubs) \
95 SC(call_megamorphic_stubs, V8.CallMegamorphicStubs) \
96 SC(arguments_adaptors, V8.ArgumentsAdaptors) \
97 SC(compilation_cache_hits, V8.CompilationCacheHits) \
98 SC(compilation_cache_misses, V8.CompilationCacheMisses) \
99 SC(regexp_cache_hits, V8.RegExpCacheHits) \
100 SC(regexp_cache_misses, V8.RegExpCacheMisses) \
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +0000101 SC(string_ctor_calls, V8.StringConstructorCalls) \
102 SC(string_ctor_conversions, V8.StringConstructorConversions) \
103 SC(string_ctor_cached_number, V8.StringConstructorCachedNumber) \
104 SC(string_ctor_string_value, V8.StringConstructorStringValue) \
105 SC(string_ctor_gc_required, V8.StringConstructorGCRequired) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000106 /* Amount of evaled source code. */ \
107 SC(total_eval_size, V8.TotalEvalSize) \
108 /* Amount of loaded source code. */ \
109 SC(total_load_size, V8.TotalLoadSize) \
110 /* Amount of parsed source code. */ \
111 SC(total_parse_size, V8.TotalParseSize) \
112 /* Amount of source code skipped over using preparsing. */ \
113 SC(total_preparse_skipped, V8.TotalPreparseSkipped) \
ager@chromium.org5b2fbee2010-09-08 06:38:15 +0000114 /* Number of symbol lookups skipped using preparsing */ \
115 SC(total_preparse_symbols_skipped, V8.TotalPreparseSymbolSkipped) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000116 /* Amount of compiled source code. */ \
117 SC(total_compile_size, V8.TotalCompileSize) \
118 /* Amount of source code compiled with the old codegen. */ \
119 SC(total_old_codegen_source_size, V8.TotalOldCodegenSourceSize) \
120 /* Amount of source code compiled with the full codegen. */ \
kmillikin@chromium.org5d8f0e62010-03-24 08:21:20 +0000121 SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \
122 /* Number of contexts created from scratch. */ \
123 SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \
124 /* Number of contexts created by partial snapshot. */ \
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +0000125 SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot) \
126 /* Number of code objects found from pc. */ \
127 SC(pc_to_code, V8.PcToCode) \
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000128 SC(pc_to_code_cached, V8.PcToCodeCached) \
129 /* The store-buffer implementation of the write barrier. */ \
130 SC(store_buffer_compactions, V8.StoreBufferCompactions) \
131 SC(store_buffer_overflows, V8.StoreBufferOverflows)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000132
133
ager@chromium.org5c838252010-02-19 08:53:10 +0000134#define STATS_COUNTER_LIST_2(SC) \
135 /* Number of code stubs. */ \
136 SC(code_stubs, V8.CodeStubs) \
137 /* Amount of stub code. */ \
138 SC(total_stubs_code_size, V8.TotalStubsCodeSize) \
139 /* Amount of (JS) compiled code. */ \
140 SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \
141 SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \
142 SC(gc_compactor_caused_by_promoted_data, \
143 V8.GCCompactorCausedByPromotedData) \
144 SC(gc_compactor_caused_by_oldspace_exhaustion, \
145 V8.GCCompactorCausedByOldspaceExhaustion) \
146 SC(gc_compactor_caused_by_weak_handles, \
147 V8.GCCompactorCausedByWeakHandles) \
148 SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \
149 SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \
150 /* How is the generic keyed-load stub used? */ \
151 SC(keyed_load_generic_smi, V8.KeyedLoadGenericSmi) \
152 SC(keyed_load_generic_symbol, V8.KeyedLoadGenericSymbol) \
sgjesse@chromium.org82dbbab2010-06-02 08:57:44 +0000153 SC(keyed_load_generic_lookup_cache, V8.KeyedLoadGenericLookupCache) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000154 SC(keyed_load_generic_slow, V8.KeyedLoadGenericSlow) \
ager@chromium.orgea91cc52011-05-23 06:06:11 +0000155 SC(keyed_load_polymorphic_stubs, V8.KeyedLoadPolymorphicStubs) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000156 SC(keyed_load_external_array_slow, V8.KeyedLoadExternalArraySlow) \
ager@chromium.org2cc82ae2010-06-14 07:35:38 +0000157 /* How is the generic keyed-call stub used? */ \
158 SC(keyed_call_generic_smi_fast, V8.KeyedCallGenericSmiFast) \
159 SC(keyed_call_generic_smi_dict, V8.KeyedCallGenericSmiDict) \
160 SC(keyed_call_generic_lookup_cache, V8.KeyedCallGenericLookupCache) \
161 SC(keyed_call_generic_lookup_dict, V8.KeyedCallGenericLookupDict) \
162 SC(keyed_call_generic_value_type, V8.KeyedCallGenericValueType) \
163 SC(keyed_call_generic_slow, V8.KeyedCallGenericSlow) \
164 SC(keyed_call_generic_slow_load, V8.KeyedCallGenericSlowLoad) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000165 /* Count how much the monomorphic keyed-load stubs are hit. */ \
166 SC(keyed_load_function_prototype, V8.KeyedLoadFunctionPrototype) \
167 SC(keyed_load_string_length, V8.KeyedLoadStringLength) \
168 SC(keyed_load_array_length, V8.KeyedLoadArrayLength) \
169 SC(keyed_load_constant_function, V8.KeyedLoadConstantFunction) \
170 SC(keyed_load_field, V8.KeyedLoadField) \
171 SC(keyed_load_callback, V8.KeyedLoadCallback) \
172 SC(keyed_load_interceptor, V8.KeyedLoadInterceptor) \
173 SC(keyed_load_inline, V8.KeyedLoadInline) \
174 SC(keyed_load_inline_miss, V8.KeyedLoadInlineMiss) \
175 SC(named_load_inline, V8.NamedLoadInline) \
176 SC(named_load_inline_miss, V8.NamedLoadInlineMiss) \
177 SC(named_load_global_inline, V8.NamedLoadGlobalInline) \
178 SC(named_load_global_inline_miss, V8.NamedLoadGlobalInlineMiss) \
ricow@chromium.orgeb7c1442010-10-04 08:54:21 +0000179 SC(dont_delete_hint_hit, V8.DontDeleteHintHit) \
180 SC(dont_delete_hint_miss, V8.DontDeleteHintMiss) \
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +0000181 SC(named_load_global_stub, V8.NamedLoadGlobalStub) \
182 SC(named_load_global_stub_miss, V8.NamedLoadGlobalStubMiss) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000183 SC(keyed_store_field, V8.KeyedStoreField) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000184 SC(named_store_inline_field, V8.NamedStoreInlineField) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000185 SC(keyed_store_inline, V8.KeyedStoreInline) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000186 SC(named_load_inline_generic, V8.NamedLoadInlineGeneric) \
187 SC(named_load_inline_field, V8.NamedLoadInlineFast) \
188 SC(keyed_load_inline_generic, V8.KeyedLoadInlineGeneric) \
189 SC(keyed_load_inline_fast, V8.KeyedLoadInlineFast) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000190 SC(keyed_store_inline_generic, V8.KeyedStoreInlineGeneric) \
191 SC(keyed_store_inline_fast, V8.KeyedStoreInlineFast) \
192 SC(named_store_inline_generic, V8.NamedStoreInlineGeneric) \
193 SC(named_store_inline_fast, V8.NamedStoreInlineFast) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000194 SC(keyed_store_inline_miss, V8.KeyedStoreInlineMiss) \
195 SC(named_store_global_inline, V8.NamedStoreGlobalInline) \
196 SC(named_store_global_inline_miss, V8.NamedStoreGlobalInlineMiss) \
ager@chromium.orgea91cc52011-05-23 06:06:11 +0000197 SC(keyed_store_polymorphic_stubs, V8.KeyedStorePolymorphicStubs) \
198 SC(keyed_store_external_array_slow, V8.KeyedStoreExternalArraySlow) \
kmillikin@chromium.org69ea3962010-07-05 11:01:40 +0000199 SC(store_normal_miss, V8.StoreNormalMiss) \
200 SC(store_normal_hit, V8.StoreNormalHit) \
ricow@chromium.org0b9f8502010-08-18 07:45:01 +0000201 SC(cow_arrays_created_stub, V8.COWArraysCreatedStub) \
202 SC(cow_arrays_created_runtime, V8.COWArraysCreatedRuntime) \
203 SC(cow_arrays_converted, V8.COWArraysConverted) \
fschneider@chromium.org40b9da32010-06-28 11:29:21 +0000204 SC(call_miss, V8.CallMiss) \
205 SC(keyed_call_miss, V8.KeyedCallMiss) \
206 SC(load_miss, V8.LoadMiss) \
207 SC(keyed_load_miss, V8.KeyedLoadMiss) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000208 SC(call_const, V8.CallConst) \
209 SC(call_const_fast_api, V8.CallConstFastApi) \
210 SC(call_const_interceptor, V8.CallConstInterceptor) \
211 SC(call_const_interceptor_fast_api, V8.CallConstInterceptorFastApi) \
212 SC(call_global_inline, V8.CallGlobalInline) \
213 SC(call_global_inline_miss, V8.CallGlobalInlineMiss) \
214 SC(constructed_objects, V8.ConstructedObjects) \
215 SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \
216 SC(constructed_objects_stub, V8.ConstructedObjectsStub) \
kmillikin@chromium.org69ea3962010-07-05 11:01:40 +0000217 SC(negative_lookups, V8.NegativeLookups) \
whesse@chromium.orgba5a61b2010-07-26 11:44:40 +0000218 SC(negative_lookups_miss, V8.NegativeLookupsMiss) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000219 SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes) \
220 SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses) \
221 SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000222 SC(array_function_runtime, V8.ArrayFunctionRuntime) \
223 SC(array_function_native, V8.ArrayFunctionNative) \
224 SC(for_in, V8.ForIn) \
225 SC(enum_cache_hits, V8.EnumCacheHits) \
226 SC(enum_cache_misses, V8.EnumCacheMisses) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000227 SC(zone_segment_bytes, V8.ZoneSegmentBytes) \
228 SC(compute_entry_frame, V8.ComputeEntryFrame) \
229 SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \
230 SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +0000231 SC(fast_new_closure_total, V8.FastNewClosureTotal) \
232 SC(fast_new_closure_try_optimized, V8.FastNewClosureTryOptimized) \
233 SC(fast_new_closure_install_optimized, V8.FastNewClosureInstallOptimized) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000234 SC(string_add_runtime, V8.StringAddRuntime) \
235 SC(string_add_native, V8.StringAddNative) \
ricow@chromium.orgaa1b6162010-03-29 07:44:58 +0000236 SC(string_add_runtime_ext_to_ascii, V8.StringAddRuntimeExtToAscii) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000237 SC(sub_string_runtime, V8.SubStringRuntime) \
238 SC(sub_string_native, V8.SubStringNative) \
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000239 SC(string_add_make_two_char, V8.StringAddMakeTwoChar) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000240 SC(string_compare_native, V8.StringCompareNative) \
241 SC(string_compare_runtime, V8.StringCompareRuntime) \
242 SC(regexp_entry_runtime, V8.RegExpEntryRuntime) \
243 SC(regexp_entry_native, V8.RegExpEntryNative) \
244 SC(number_to_string_native, V8.NumberToStringNative) \
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000245 SC(number_to_string_runtime, V8.NumberToStringRuntime) \
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000246 SC(math_acos, V8.MathAcos) \
247 SC(math_asin, V8.MathAsin) \
248 SC(math_atan, V8.MathAtan) \
249 SC(math_atan2, V8.MathAtan2) \
250 SC(math_ceil, V8.MathCeil) \
251 SC(math_cos, V8.MathCos) \
252 SC(math_exp, V8.MathExp) \
253 SC(math_floor, V8.MathFloor) \
254 SC(math_log, V8.MathLog) \
255 SC(math_pow, V8.MathPow) \
256 SC(math_round, V8.MathRound) \
257 SC(math_sin, V8.MathSin) \
258 SC(math_sqrt, V8.MathSqrt) \
259 SC(math_tan, V8.MathTan) \
260 SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000261 SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) \
262 SC(stack_interrupts, V8.StackInterrupts) \
263 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000264 SC(smi_checks_removed, V8.SmiChecksRemoved) \
265 SC(map_checks_removed, V8.MapChecksRemoved) \
266 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \
jkummerow@chromium.org7a6fc812012-06-27 11:12:38 +0000267 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) \
268 SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
269 SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
270 SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
271 SC(old_pointer_space_bytes_available, \
272 V8.MemoryOldPointerSpaceBytesAvailable) \
273 SC(old_pointer_space_bytes_committed, \
274 V8.MemoryOldPointerSpaceBytesCommitted) \
275 SC(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
276 SC(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
277 SC(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
278 SC(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
279 SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
280 SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
281 SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
282 SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
283 SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
284 SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
285 SC(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
286 SC(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
287 SC(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
288 SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
289 SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
290 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000291
kmillikin@chromium.org5d8f0e62010-03-24 08:21:20 +0000292
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000293// This file contains all the v8 counters that are in use.
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000294class Counters {
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000295 public:
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000296#define HT(name, caption) \
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000297 HistogramTimer* name() { return &name##_; }
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000298 HISTOGRAM_TIMER_LIST(HT)
299#undef HT
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000300
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000301#define HP(name, caption) \
302 Histogram* name() { return &name##_; }
303 HISTOGRAM_PERCENTAGE_LIST(HP)
304#undef HP
305
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000306#define SC(name, caption) \
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000307 StatsCounter* name() { return &name##_; }
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000308 STATS_COUNTER_LIST_1(SC)
309 STATS_COUNTER_LIST_2(SC)
310#undef SC
311
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000312#define SC(name) \
313 StatsCounter* count_of_##name() { return &count_of_##name##_; } \
314 StatsCounter* size_of_##name() { return &size_of_##name##_; }
315 INSTANCE_TYPE_LIST(SC)
316#undef SC
317
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000318#define SC(name) \
319 StatsCounter* count_of_CODE_TYPE_##name() \
320 { return &count_of_CODE_TYPE_##name##_; } \
321 StatsCounter* size_of_CODE_TYPE_##name() \
322 { return &size_of_CODE_TYPE_##name##_; }
323 CODE_KIND_LIST(SC)
324#undef SC
325
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000326 enum Id {
327#define RATE_ID(name, caption) k_##name,
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000328 HISTOGRAM_TIMER_LIST(RATE_ID)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000329#undef RATE_ID
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000330#define PERCENTAGE_ID(name, caption) k_##name,
331 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
332#undef PERCENTAGE_ID
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000333#define COUNTER_ID(name, caption) k_##name,
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000334 STATS_COUNTER_LIST_1(COUNTER_ID)
335 STATS_COUNTER_LIST_2(COUNTER_ID)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000336#undef COUNTER_ID
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000337#define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
338 INSTANCE_TYPE_LIST(COUNTER_ID)
339#undef COUNTER_ID
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000340#define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
341 kSizeOfCODE_TYPE_##name,
342 CODE_KIND_LIST(COUNTER_ID)
343#undef COUNTER_ID
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000344#define COUNTER_ID(name) k_##name,
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000345 STATE_TAG_LIST(COUNTER_ID)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000346#undef COUNTER_ID
347 stats_counter_count
348 };
349
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000350 StatsCounter* state_counters(StateTag state) {
351 return &state_counters_[state];
352 }
353
354 private:
355#define HT(name, caption) \
356 HistogramTimer name##_;
357 HISTOGRAM_TIMER_LIST(HT)
358#undef HT
359
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000360#define HP(name, caption) \
361 Histogram name##_;
362 HISTOGRAM_PERCENTAGE_LIST(HP)
363#undef HP
364
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000365#define SC(name, caption) \
366 StatsCounter name##_;
367 STATS_COUNTER_LIST_1(SC)
368 STATS_COUNTER_LIST_2(SC)
369#undef SC
370
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000371#define SC(name) \
372 StatsCounter size_of_##name##_; \
373 StatsCounter count_of_##name##_;
374 INSTANCE_TYPE_LIST(SC)
375#undef SC
376
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000377#define SC(name) \
378 StatsCounter size_of_CODE_TYPE_##name##_; \
379 StatsCounter count_of_CODE_TYPE_##name##_;
380 CODE_KIND_LIST(SC)
381#undef SC
382
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000383 enum {
384#define COUNTER_ID(name) __##name,
385 STATE_TAG_LIST(COUNTER_ID)
386#undef COUNTER_ID
387 kSlidingStateWindowCounterCount
388 };
389
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000390 // Sliding state window counters.
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000391 StatsCounter state_counters_[kSlidingStateWindowCounterCount];
392 friend class Isolate;
393
394 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000395};
396
397} } // namespace v8::internal
398
ager@chromium.org5ec48922009-05-05 07:25:34 +0000399#endif // V8_V8_COUNTERS_H_