blob: 374ebbcd897638b8d1846137c6c26afd1354187b [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
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000053#define HISTOGRAM_PERCENTAGE_LIST(HP) \
verwaest@chromium.org753aee42012-07-17 16:15:42 +000054 HP(external_fragmentation_total, \
55 V8.MemoryExternalFragmentationTotal) \
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000056 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, \
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +000067 V8.MemoryExternalFragmentationLoSpace) \
68 HP(heap_fraction_map_space, \
69 V8.MemoryHeapFractionMapSpace) \
70 HP(heap_fraction_cell_space, \
71 V8.MemoryHeapFractionCellSpace) \
72
73
74#define HISTOGRAM_MEMORY_LIST(HM) \
75 HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted) \
76 HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed) \
77 HM(heap_sample_map_space_committed, \
78 V8.MemoryHeapSampleMapSpaceCommitted) \
79 HM(heap_sample_cell_space_committed, \
80 V8.MemoryHeapSampleCellSpaceCommitted)
jkummerow@chromium.org28583c92012-07-16 11:31:55 +000081
82
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +000083// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
84// Intellisense to crash. It was broken into two macros (each of length 40
85// lines) rather than one macro (of length about 80 lines) to work around
86// this problem. Please avoid using recursive macros of this length when
87// possible.
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +000088#define STATS_COUNTER_LIST_1(SC) \
89 /* Global Handle Count*/ \
90 SC(global_handles, V8.GlobalHandles) \
91 /* Mallocs from PCRE */ \
92 SC(pcre_mallocs, V8.PcreMallocCount) \
93 /* OS Memory allocated */ \
94 SC(memory_allocated, V8.OsMemoryAllocated) \
ricow@chromium.org65fae842010-08-25 15:26:24 +000095 SC(normalized_maps, V8.NormalizedMaps) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +000096 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) \
yangguo@chromium.org4a9f6552013-03-04 14:46:33 +0000101 SC(string_table_capacity, V8.StringTableCapacity) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000102 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(regexp_cache_hits, V8.RegExpCacheHits) \
112 SC(regexp_cache_misses, V8.RegExpCacheMisses) \
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +0000113 SC(string_ctor_calls, V8.StringConstructorCalls) \
114 SC(string_ctor_conversions, V8.StringConstructorConversions) \
115 SC(string_ctor_cached_number, V8.StringConstructorCachedNumber) \
116 SC(string_ctor_string_value, V8.StringConstructorStringValue) \
117 SC(string_ctor_gc_required, V8.StringConstructorGCRequired) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000118 /* Amount of evaled source code. */ \
119 SC(total_eval_size, V8.TotalEvalSize) \
120 /* Amount of loaded source code. */ \
121 SC(total_load_size, V8.TotalLoadSize) \
122 /* Amount of parsed source code. */ \
123 SC(total_parse_size, V8.TotalParseSize) \
124 /* Amount of source code skipped over using preparsing. */ \
125 SC(total_preparse_skipped, V8.TotalPreparseSkipped) \
ager@chromium.org5b2fbee2010-09-08 06:38:15 +0000126 /* Number of symbol lookups skipped using preparsing */ \
127 SC(total_preparse_symbols_skipped, V8.TotalPreparseSymbolSkipped) \
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000128 /* Amount of compiled source code. */ \
129 SC(total_compile_size, V8.TotalCompileSize) \
130 /* Amount of source code compiled with the old codegen. */ \
131 SC(total_old_codegen_source_size, V8.TotalOldCodegenSourceSize) \
132 /* Amount of source code compiled with the full codegen. */ \
kmillikin@chromium.org5d8f0e62010-03-24 08:21:20 +0000133 SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \
134 /* Number of contexts created from scratch. */ \
135 SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \
136 /* Number of contexts created by partial snapshot. */ \
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +0000137 SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot) \
138 /* Number of code objects found from pc. */ \
139 SC(pc_to_code, V8.PcToCode) \
erik.corry@gmail.comc3b670f2011-10-05 21:44:48 +0000140 SC(pc_to_code_cached, V8.PcToCodeCached) \
141 /* The store-buffer implementation of the write barrier. */ \
142 SC(store_buffer_compactions, V8.StoreBufferCompactions) \
143 SC(store_buffer_overflows, V8.StoreBufferOverflows)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000144
145
ager@chromium.org5c838252010-02-19 08:53:10 +0000146#define STATS_COUNTER_LIST_2(SC) \
147 /* Number of code stubs. */ \
148 SC(code_stubs, V8.CodeStubs) \
149 /* Amount of stub code. */ \
150 SC(total_stubs_code_size, V8.TotalStubsCodeSize) \
151 /* Amount of (JS) compiled code. */ \
152 SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \
153 SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \
154 SC(gc_compactor_caused_by_promoted_data, \
155 V8.GCCompactorCausedByPromotedData) \
156 SC(gc_compactor_caused_by_oldspace_exhaustion, \
157 V8.GCCompactorCausedByOldspaceExhaustion) \
158 SC(gc_compactor_caused_by_weak_handles, \
159 V8.GCCompactorCausedByWeakHandles) \
160 SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \
161 SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \
162 /* How is the generic keyed-load stub used? */ \
163 SC(keyed_load_generic_smi, V8.KeyedLoadGenericSmi) \
164 SC(keyed_load_generic_symbol, V8.KeyedLoadGenericSymbol) \
sgjesse@chromium.org82dbbab2010-06-02 08:57:44 +0000165 SC(keyed_load_generic_lookup_cache, V8.KeyedLoadGenericLookupCache) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000166 SC(keyed_load_generic_slow, V8.KeyedLoadGenericSlow) \
ager@chromium.orgea91cc52011-05-23 06:06:11 +0000167 SC(keyed_load_polymorphic_stubs, V8.KeyedLoadPolymorphicStubs) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000168 SC(keyed_load_external_array_slow, V8.KeyedLoadExternalArraySlow) \
ager@chromium.org2cc82ae2010-06-14 07:35:38 +0000169 /* How is the generic keyed-call stub used? */ \
170 SC(keyed_call_generic_smi_fast, V8.KeyedCallGenericSmiFast) \
171 SC(keyed_call_generic_smi_dict, V8.KeyedCallGenericSmiDict) \
172 SC(keyed_call_generic_lookup_cache, V8.KeyedCallGenericLookupCache) \
173 SC(keyed_call_generic_lookup_dict, V8.KeyedCallGenericLookupDict) \
174 SC(keyed_call_generic_value_type, V8.KeyedCallGenericValueType) \
175 SC(keyed_call_generic_slow, V8.KeyedCallGenericSlow) \
176 SC(keyed_call_generic_slow_load, V8.KeyedCallGenericSlowLoad) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000177 /* Count how much the monomorphic keyed-load stubs are hit. */ \
178 SC(keyed_load_function_prototype, V8.KeyedLoadFunctionPrototype) \
179 SC(keyed_load_string_length, V8.KeyedLoadStringLength) \
180 SC(keyed_load_array_length, V8.KeyedLoadArrayLength) \
181 SC(keyed_load_constant_function, V8.KeyedLoadConstantFunction) \
182 SC(keyed_load_field, V8.KeyedLoadField) \
183 SC(keyed_load_callback, V8.KeyedLoadCallback) \
184 SC(keyed_load_interceptor, V8.KeyedLoadInterceptor) \
185 SC(keyed_load_inline, V8.KeyedLoadInline) \
186 SC(keyed_load_inline_miss, V8.KeyedLoadInlineMiss) \
187 SC(named_load_inline, V8.NamedLoadInline) \
188 SC(named_load_inline_miss, V8.NamedLoadInlineMiss) \
189 SC(named_load_global_inline, V8.NamedLoadGlobalInline) \
190 SC(named_load_global_inline_miss, V8.NamedLoadGlobalInlineMiss) \
ricow@chromium.orgeb7c1442010-10-04 08:54:21 +0000191 SC(dont_delete_hint_hit, V8.DontDeleteHintHit) \
192 SC(dont_delete_hint_miss, V8.DontDeleteHintMiss) \
fschneider@chromium.orgc20610a2010-09-22 09:44:58 +0000193 SC(named_load_global_stub, V8.NamedLoadGlobalStub) \
194 SC(named_load_global_stub_miss, V8.NamedLoadGlobalStubMiss) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000195 SC(keyed_store_field, V8.KeyedStoreField) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000196 SC(named_store_inline_field, V8.NamedStoreInlineField) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000197 SC(keyed_store_inline, V8.KeyedStoreInline) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000198 SC(named_load_inline_generic, V8.NamedLoadInlineGeneric) \
199 SC(named_load_inline_field, V8.NamedLoadInlineFast) \
200 SC(keyed_load_inline_generic, V8.KeyedLoadInlineGeneric) \
201 SC(keyed_load_inline_fast, V8.KeyedLoadInlineFast) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000202 SC(keyed_store_inline_generic, V8.KeyedStoreInlineGeneric) \
203 SC(keyed_store_inline_fast, V8.KeyedStoreInlineFast) \
204 SC(named_store_inline_generic, V8.NamedStoreInlineGeneric) \
205 SC(named_store_inline_fast, V8.NamedStoreInlineFast) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000206 SC(keyed_store_inline_miss, V8.KeyedStoreInlineMiss) \
207 SC(named_store_global_inline, V8.NamedStoreGlobalInline) \
208 SC(named_store_global_inline_miss, V8.NamedStoreGlobalInlineMiss) \
ager@chromium.orgea91cc52011-05-23 06:06:11 +0000209 SC(keyed_store_polymorphic_stubs, V8.KeyedStorePolymorphicStubs) \
210 SC(keyed_store_external_array_slow, V8.KeyedStoreExternalArraySlow) \
kmillikin@chromium.org69ea3962010-07-05 11:01:40 +0000211 SC(store_normal_miss, V8.StoreNormalMiss) \
212 SC(store_normal_hit, V8.StoreNormalHit) \
ricow@chromium.org0b9f8502010-08-18 07:45:01 +0000213 SC(cow_arrays_created_stub, V8.COWArraysCreatedStub) \
214 SC(cow_arrays_created_runtime, V8.COWArraysCreatedRuntime) \
215 SC(cow_arrays_converted, V8.COWArraysConverted) \
fschneider@chromium.org40b9da32010-06-28 11:29:21 +0000216 SC(call_miss, V8.CallMiss) \
217 SC(keyed_call_miss, V8.KeyedCallMiss) \
218 SC(load_miss, V8.LoadMiss) \
219 SC(keyed_load_miss, V8.KeyedLoadMiss) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000220 SC(call_const, V8.CallConst) \
221 SC(call_const_fast_api, V8.CallConstFastApi) \
222 SC(call_const_interceptor, V8.CallConstInterceptor) \
223 SC(call_const_interceptor_fast_api, V8.CallConstInterceptorFastApi) \
224 SC(call_global_inline, V8.CallGlobalInline) \
225 SC(call_global_inline_miss, V8.CallGlobalInlineMiss) \
226 SC(constructed_objects, V8.ConstructedObjects) \
227 SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \
228 SC(constructed_objects_stub, V8.ConstructedObjectsStub) \
kmillikin@chromium.org69ea3962010-07-05 11:01:40 +0000229 SC(negative_lookups, V8.NegativeLookups) \
whesse@chromium.orgba5a61b2010-07-26 11:44:40 +0000230 SC(negative_lookups_miss, V8.NegativeLookupsMiss) \
ulan@chromium.org812308e2012-02-29 15:58:45 +0000231 SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes) \
232 SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses) \
233 SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000234 SC(array_function_runtime, V8.ArrayFunctionRuntime) \
235 SC(array_function_native, V8.ArrayFunctionNative) \
236 SC(for_in, V8.ForIn) \
237 SC(enum_cache_hits, V8.EnumCacheHits) \
238 SC(enum_cache_misses, V8.EnumCacheMisses) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000239 SC(zone_segment_bytes, V8.ZoneSegmentBytes) \
240 SC(compute_entry_frame, V8.ComputeEntryFrame) \
241 SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \
242 SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \
yangguo@chromium.org5a11aaf2012-06-20 11:29:00 +0000243 SC(fast_new_closure_total, V8.FastNewClosureTotal) \
244 SC(fast_new_closure_try_optimized, V8.FastNewClosureTryOptimized) \
245 SC(fast_new_closure_install_optimized, V8.FastNewClosureInstallOptimized) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000246 SC(string_add_runtime, V8.StringAddRuntime) \
247 SC(string_add_native, V8.StringAddNative) \
ricow@chromium.orgaa1b6162010-03-29 07:44:58 +0000248 SC(string_add_runtime_ext_to_ascii, V8.StringAddRuntimeExtToAscii) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000249 SC(sub_string_runtime, V8.SubStringRuntime) \
250 SC(sub_string_native, V8.SubStringNative) \
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000251 SC(string_add_make_two_char, V8.StringAddMakeTwoChar) \
ager@chromium.org5c838252010-02-19 08:53:10 +0000252 SC(string_compare_native, V8.StringCompareNative) \
253 SC(string_compare_runtime, V8.StringCompareRuntime) \
254 SC(regexp_entry_runtime, V8.RegExpEntryRuntime) \
255 SC(regexp_entry_native, V8.RegExpEntryNative) \
256 SC(number_to_string_native, V8.NumberToStringNative) \
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000257 SC(number_to_string_runtime, V8.NumberToStringRuntime) \
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000258 SC(math_acos, V8.MathAcos) \
259 SC(math_asin, V8.MathAsin) \
260 SC(math_atan, V8.MathAtan) \
261 SC(math_atan2, V8.MathAtan2) \
262 SC(math_ceil, V8.MathCeil) \
263 SC(math_cos, V8.MathCos) \
264 SC(math_exp, V8.MathExp) \
265 SC(math_floor, V8.MathFloor) \
266 SC(math_log, V8.MathLog) \
267 SC(math_pow, V8.MathPow) \
268 SC(math_round, V8.MathRound) \
269 SC(math_sin, V8.MathSin) \
270 SC(math_sqrt, V8.MathSqrt) \
271 SC(math_tan, V8.MathTan) \
272 SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000273 SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) \
274 SC(stack_interrupts, V8.StackInterrupts) \
275 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000276 SC(smi_checks_removed, V8.SmiChecksRemoved) \
277 SC(map_checks_removed, V8.MapChecksRemoved) \
278 SC(quote_json_char_count, V8.QuoteJsonCharacterCount) \
jkummerow@chromium.org7a6fc812012-06-27 11:12:38 +0000279 SC(quote_json_char_recount, V8.QuoteJsonCharacterReCount) \
280 SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
281 SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
282 SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
283 SC(old_pointer_space_bytes_available, \
284 V8.MemoryOldPointerSpaceBytesAvailable) \
285 SC(old_pointer_space_bytes_committed, \
286 V8.MemoryOldPointerSpaceBytesCommitted) \
287 SC(old_pointer_space_bytes_used, V8.MemoryOldPointerSpaceBytesUsed) \
288 SC(old_data_space_bytes_available, V8.MemoryOldDataSpaceBytesAvailable) \
289 SC(old_data_space_bytes_committed, V8.MemoryOldDataSpaceBytesCommitted) \
290 SC(old_data_space_bytes_used, V8.MemoryOldDataSpaceBytesUsed) \
291 SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \
292 SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \
293 SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \
294 SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \
295 SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \
296 SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
297 SC(cell_space_bytes_available, V8.MemoryCellSpaceBytesAvailable) \
298 SC(cell_space_bytes_committed, V8.MemoryCellSpaceBytesCommitted) \
299 SC(cell_space_bytes_used, V8.MemoryCellSpaceBytesUsed) \
300 SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
301 SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
302 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000303
kmillikin@chromium.org5d8f0e62010-03-24 08:21:20 +0000304
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000305// This file contains all the v8 counters that are in use.
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000306class Counters {
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000307 public:
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000308#define HT(name, caption) \
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000309 HistogramTimer* name() { return &name##_; }
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000310 HISTOGRAM_TIMER_LIST(HT)
311#undef HT
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000312
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000313#define HP(name, caption) \
314 Histogram* name() { return &name##_; }
315 HISTOGRAM_PERCENTAGE_LIST(HP)
316#undef HP
317
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000318#define HM(name, caption) \
319 Histogram* name() { return &name##_; }
320 HISTOGRAM_MEMORY_LIST(HM)
321#undef HM
322
kasperl@chromium.orgb9123622008-09-17 14:05:56 +0000323#define SC(name, caption) \
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000324 StatsCounter* name() { return &name##_; }
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000325 STATS_COUNTER_LIST_1(SC)
326 STATS_COUNTER_LIST_2(SC)
327#undef SC
328
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000329#define SC(name) \
330 StatsCounter* count_of_##name() { return &count_of_##name##_; } \
331 StatsCounter* size_of_##name() { return &size_of_##name##_; }
332 INSTANCE_TYPE_LIST(SC)
333#undef SC
334
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000335#define SC(name) \
336 StatsCounter* count_of_CODE_TYPE_##name() \
337 { return &count_of_CODE_TYPE_##name##_; } \
338 StatsCounter* size_of_CODE_TYPE_##name() \
339 { return &size_of_CODE_TYPE_##name##_; }
340 CODE_KIND_LIST(SC)
341#undef SC
342
yangguo@chromium.org304cc332012-07-24 07:59:48 +0000343#define SC(name) \
344 StatsCounter* count_of_FIXED_ARRAY_##name() \
345 { return &count_of_FIXED_ARRAY_##name##_; } \
346 StatsCounter* size_of_FIXED_ARRAY_##name() \
347 { return &size_of_FIXED_ARRAY_##name##_; }
348 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
349#undef SC
350
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000351 enum Id {
352#define RATE_ID(name, caption) k_##name,
ager@chromium.orgbb29dc92009-03-24 13:25:23 +0000353 HISTOGRAM_TIMER_LIST(RATE_ID)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000354#undef RATE_ID
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000355#define PERCENTAGE_ID(name, caption) k_##name,
356 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
357#undef PERCENTAGE_ID
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000358#define MEMORY_ID(name, caption) k_##name,
359 HISTOGRAM_MEMORY_LIST(MEMORY_ID)
360#undef MEMORY_ID
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000361#define COUNTER_ID(name, caption) k_##name,
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000362 STATS_COUNTER_LIST_1(COUNTER_ID)
363 STATS_COUNTER_LIST_2(COUNTER_ID)
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000364#undef COUNTER_ID
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000365#define COUNTER_ID(name) kCountOf##name, kSizeOf##name,
366 INSTANCE_TYPE_LIST(COUNTER_ID)
367#undef COUNTER_ID
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000368#define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \
369 kSizeOfCODE_TYPE_##name,
370 CODE_KIND_LIST(COUNTER_ID)
371#undef COUNTER_ID
yangguo@chromium.org304cc332012-07-24 07:59:48 +0000372#define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \
373 kSizeOfFIXED_ARRAY__##name,
374 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
375#undef COUNTER_ID
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000376 stats_counter_count
377 };
378
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000379 void ResetHistograms();
380
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000381 private:
382#define HT(name, caption) \
383 HistogramTimer name##_;
384 HISTOGRAM_TIMER_LIST(HT)
385#undef HT
386
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000387#define HP(name, caption) \
388 Histogram name##_;
389 HISTOGRAM_PERCENTAGE_LIST(HP)
390#undef HP
391
mstarzinger@chromium.org471f2f12012-08-10 14:46:33 +0000392#define HM(name, caption) \
393 Histogram name##_;
394 HISTOGRAM_MEMORY_LIST(HM)
395#undef HM
396
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000397#define SC(name, caption) \
398 StatsCounter name##_;
399 STATS_COUNTER_LIST_1(SC)
400 STATS_COUNTER_LIST_2(SC)
401#undef SC
402
jkummerow@chromium.org28583c92012-07-16 11:31:55 +0000403#define SC(name) \
404 StatsCounter size_of_##name##_; \
405 StatsCounter count_of_##name##_;
406 INSTANCE_TYPE_LIST(SC)
407#undef SC
408
verwaest@chromium.org753aee42012-07-17 16:15:42 +0000409#define SC(name) \
410 StatsCounter size_of_CODE_TYPE_##name##_; \
411 StatsCounter count_of_CODE_TYPE_##name##_;
412 CODE_KIND_LIST(SC)
413#undef SC
414
yangguo@chromium.org304cc332012-07-24 07:59:48 +0000415#define SC(name) \
416 StatsCounter size_of_FIXED_ARRAY_##name##_; \
417 StatsCounter count_of_FIXED_ARRAY_##name##_;
418 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
419#undef SC
420
sgjesse@chromium.orgea88ce92011-03-23 11:19:56 +0000421 friend class Isolate;
422
423 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
christian.plesner.hansen43d26ec2008-07-03 15:10:15 +0000424};
425
426} } // namespace v8::internal
427
ager@chromium.org5ec48922009-05-05 07:25:34 +0000428#endif // V8_V8_COUNTERS_H_