ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | // Copyright 2007-2008 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // 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 | |
| 31 | #include "counters.h" |
| 32 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 33 | namespace v8 { |
| 34 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 35 | |
kasperl@chromium.org | b3284ad | 2009-05-18 06:12:45 +0000 | [diff] [blame] | 36 | #define HISTOGRAM_TIMER_LIST(HT) \ |
| 37 | /* Garbage collection timers. */ \ |
| 38 | HT(gc_compactor, V8.GCCompactor) \ |
| 39 | HT(gc_scavenger, V8.GCScavenger) \ |
| 40 | HT(gc_context, V8.GCContext) /* GC context cleanup time */ \ |
| 41 | /* Parsing timers. */ \ |
| 42 | HT(parse, V8.Parse) \ |
| 43 | HT(parse_lazy, V8.ParseLazy) \ |
| 44 | HT(pre_parse, V8.PreParse) \ |
| 45 | /* Total compilation times. */ \ |
| 46 | HT(compile, V8.Compile) \ |
| 47 | HT(compile_eval, V8.CompileEval) \ |
| 48 | HT(compile_lazy, V8.CompileLazy) \ |
| 49 | /* Individual compiler passes. */ \ |
| 50 | HT(rewriting, V8.Rewriting) \ |
| 51 | HT(usage_analysis, V8.UsageAnalysis) \ |
| 52 | HT(variable_allocation, V8.VariableAllocation) \ |
| 53 | HT(ast_optimization, V8.ASTOptimization) \ |
| 54 | HT(code_generation, V8.CodeGeneration) \ |
christian.plesner.hansen@gmail.com | 9d58c2b | 2009-10-16 11:48:38 +0000 | [diff] [blame] | 55 | HT(deferred_code_generation, V8.DeferredCodeGeneration) |
| 56 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 57 | |
| 58 | // WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC |
| 59 | // Intellisense to crash. It was broken into two macros (each of length 40 |
| 60 | // lines) rather than one macro (of length about 80 lines) to work around |
| 61 | // this problem. Please avoid using recursive macros of this length when |
| 62 | // possible. |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 63 | #define STATS_COUNTER_LIST_1(SC) \ |
| 64 | /* Global Handle Count*/ \ |
| 65 | SC(global_handles, V8.GlobalHandles) \ |
| 66 | /* Mallocs from PCRE */ \ |
| 67 | SC(pcre_mallocs, V8.PcreMallocCount) \ |
| 68 | /* OS Memory allocated */ \ |
| 69 | SC(memory_allocated, V8.OsMemoryAllocated) \ |
| 70 | SC(props_to_dictionary, V8.ObjectPropertiesToDictionary) \ |
| 71 | SC(elements_to_dictionary, V8.ObjectElementsToDictionary) \ |
| 72 | SC(alive_after_last_gc, V8.AliveAfterLastGC) \ |
| 73 | SC(objs_since_last_young, V8.ObjsSinceLastYoung) \ |
| 74 | SC(objs_since_last_full, V8.ObjsSinceLastFull) \ |
| 75 | SC(symbol_table_capacity, V8.SymbolTableCapacity) \ |
| 76 | SC(number_of_symbols, V8.NumberOfSymbols) \ |
| 77 | SC(script_wrappers, V8.ScriptWrappers) \ |
| 78 | SC(call_initialize_stubs, V8.CallInitializeStubs) \ |
| 79 | SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs) \ |
| 80 | SC(call_normal_stubs, V8.CallNormalStubs) \ |
| 81 | SC(call_megamorphic_stubs, V8.CallMegamorphicStubs) \ |
| 82 | SC(arguments_adaptors, V8.ArgumentsAdaptors) \ |
| 83 | SC(compilation_cache_hits, V8.CompilationCacheHits) \ |
| 84 | SC(compilation_cache_misses, V8.CompilationCacheMisses) \ |
| 85 | SC(regexp_cache_hits, V8.RegExpCacheHits) \ |
| 86 | SC(regexp_cache_misses, V8.RegExpCacheMisses) \ |
| 87 | /* Amount of evaled source code. */ \ |
| 88 | SC(total_eval_size, V8.TotalEvalSize) \ |
| 89 | /* Amount of loaded source code. */ \ |
| 90 | SC(total_load_size, V8.TotalLoadSize) \ |
| 91 | /* Amount of parsed source code. */ \ |
| 92 | SC(total_parse_size, V8.TotalParseSize) \ |
| 93 | /* Amount of source code skipped over using preparsing. */ \ |
| 94 | SC(total_preparse_skipped, V8.TotalPreparseSkipped) \ |
| 95 | /* Amount of compiled source code. */ \ |
| 96 | SC(total_compile_size, V8.TotalCompileSize) \ |
| 97 | /* Amount of source code compiled with the old codegen. */ \ |
| 98 | SC(total_old_codegen_source_size, V8.TotalOldCodegenSourceSize) \ |
| 99 | /* Amount of source code compiled with the full codegen. */ \ |
kmillikin@chromium.org | 5d8f0e6 | 2010-03-24 08:21:20 +0000 | [diff] [blame] | 100 | SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \ |
| 101 | /* Number of contexts created from scratch. */ \ |
| 102 | SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \ |
| 103 | /* Number of contexts created by partial snapshot. */ \ |
| 104 | SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 105 | |
| 106 | |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 107 | #define STATS_COUNTER_LIST_2(SC) \ |
| 108 | /* Number of code stubs. */ \ |
| 109 | SC(code_stubs, V8.CodeStubs) \ |
| 110 | /* Amount of stub code. */ \ |
| 111 | SC(total_stubs_code_size, V8.TotalStubsCodeSize) \ |
| 112 | /* Amount of (JS) compiled code. */ \ |
| 113 | SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \ |
| 114 | SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \ |
| 115 | SC(gc_compactor_caused_by_promoted_data, \ |
| 116 | V8.GCCompactorCausedByPromotedData) \ |
| 117 | SC(gc_compactor_caused_by_oldspace_exhaustion, \ |
| 118 | V8.GCCompactorCausedByOldspaceExhaustion) \ |
| 119 | SC(gc_compactor_caused_by_weak_handles, \ |
| 120 | V8.GCCompactorCausedByWeakHandles) \ |
| 121 | SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \ |
| 122 | SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \ |
ricow@chromium.org | 0b9f850 | 2010-08-18 07:45:01 +0000 | [diff] [blame^] | 123 | SC(map_slow_to_fast_elements, V8.MapSlowToFastElements) \ |
| 124 | SC(map_fast_to_slow_elements, V8.MapFastToSlowElements) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 125 | /* How is the generic keyed-load stub used? */ \ |
| 126 | SC(keyed_load_generic_smi, V8.KeyedLoadGenericSmi) \ |
| 127 | SC(keyed_load_generic_symbol, V8.KeyedLoadGenericSymbol) \ |
sgjesse@chromium.org | 82dbbab | 2010-06-02 08:57:44 +0000 | [diff] [blame] | 128 | SC(keyed_load_generic_lookup_cache, V8.KeyedLoadGenericLookupCache) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 129 | SC(keyed_load_generic_slow, V8.KeyedLoadGenericSlow) \ |
| 130 | SC(keyed_load_external_array_slow, V8.KeyedLoadExternalArraySlow) \ |
ager@chromium.org | 2cc82ae | 2010-06-14 07:35:38 +0000 | [diff] [blame] | 131 | /* How is the generic keyed-call stub used? */ \ |
| 132 | SC(keyed_call_generic_smi_fast, V8.KeyedCallGenericSmiFast) \ |
| 133 | SC(keyed_call_generic_smi_dict, V8.KeyedCallGenericSmiDict) \ |
| 134 | SC(keyed_call_generic_lookup_cache, V8.KeyedCallGenericLookupCache) \ |
| 135 | SC(keyed_call_generic_lookup_dict, V8.KeyedCallGenericLookupDict) \ |
| 136 | SC(keyed_call_generic_value_type, V8.KeyedCallGenericValueType) \ |
| 137 | SC(keyed_call_generic_slow, V8.KeyedCallGenericSlow) \ |
| 138 | SC(keyed_call_generic_slow_load, V8.KeyedCallGenericSlowLoad) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 139 | /* Count how much the monomorphic keyed-load stubs are hit. */ \ |
| 140 | SC(keyed_load_function_prototype, V8.KeyedLoadFunctionPrototype) \ |
| 141 | SC(keyed_load_string_length, V8.KeyedLoadStringLength) \ |
| 142 | SC(keyed_load_array_length, V8.KeyedLoadArrayLength) \ |
| 143 | SC(keyed_load_constant_function, V8.KeyedLoadConstantFunction) \ |
| 144 | SC(keyed_load_field, V8.KeyedLoadField) \ |
| 145 | SC(keyed_load_callback, V8.KeyedLoadCallback) \ |
| 146 | SC(keyed_load_interceptor, V8.KeyedLoadInterceptor) \ |
| 147 | SC(keyed_load_inline, V8.KeyedLoadInline) \ |
| 148 | SC(keyed_load_inline_miss, V8.KeyedLoadInlineMiss) \ |
| 149 | SC(named_load_inline, V8.NamedLoadInline) \ |
| 150 | SC(named_load_inline_miss, V8.NamedLoadInlineMiss) \ |
| 151 | SC(named_load_global_inline, V8.NamedLoadGlobalInline) \ |
| 152 | SC(named_load_global_inline_miss, V8.NamedLoadGlobalInlineMiss) \ |
| 153 | SC(keyed_store_field, V8.KeyedStoreField) \ |
| 154 | SC(keyed_store_inline, V8.KeyedStoreInline) \ |
| 155 | SC(keyed_store_inline_miss, V8.KeyedStoreInlineMiss) \ |
| 156 | SC(named_store_global_inline, V8.NamedStoreGlobalInline) \ |
| 157 | SC(named_store_global_inline_miss, V8.NamedStoreGlobalInlineMiss) \ |
kmillikin@chromium.org | 69ea396 | 2010-07-05 11:01:40 +0000 | [diff] [blame] | 158 | SC(store_normal_miss, V8.StoreNormalMiss) \ |
| 159 | SC(store_normal_hit, V8.StoreNormalHit) \ |
ricow@chromium.org | 0b9f850 | 2010-08-18 07:45:01 +0000 | [diff] [blame^] | 160 | SC(cow_arrays_created_stub, V8.COWArraysCreatedStub) \ |
| 161 | SC(cow_arrays_created_runtime, V8.COWArraysCreatedRuntime) \ |
| 162 | SC(cow_arrays_converted, V8.COWArraysConverted) \ |
fschneider@chromium.org | 40b9da3 | 2010-06-28 11:29:21 +0000 | [diff] [blame] | 163 | SC(call_miss, V8.CallMiss) \ |
| 164 | SC(keyed_call_miss, V8.KeyedCallMiss) \ |
| 165 | SC(load_miss, V8.LoadMiss) \ |
| 166 | SC(keyed_load_miss, V8.KeyedLoadMiss) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 167 | SC(call_const, V8.CallConst) \ |
| 168 | SC(call_const_fast_api, V8.CallConstFastApi) \ |
| 169 | SC(call_const_interceptor, V8.CallConstInterceptor) \ |
| 170 | SC(call_const_interceptor_fast_api, V8.CallConstInterceptorFastApi) \ |
| 171 | SC(call_global_inline, V8.CallGlobalInline) \ |
| 172 | SC(call_global_inline_miss, V8.CallGlobalInlineMiss) \ |
| 173 | SC(constructed_objects, V8.ConstructedObjects) \ |
| 174 | SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \ |
| 175 | SC(constructed_objects_stub, V8.ConstructedObjectsStub) \ |
kmillikin@chromium.org | 69ea396 | 2010-07-05 11:01:40 +0000 | [diff] [blame] | 176 | SC(negative_lookups, V8.NegativeLookups) \ |
whesse@chromium.org | ba5a61b | 2010-07-26 11:44:40 +0000 | [diff] [blame] | 177 | SC(negative_lookups_miss, V8.NegativeLookupsMiss) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 178 | SC(array_function_runtime, V8.ArrayFunctionRuntime) \ |
| 179 | SC(array_function_native, V8.ArrayFunctionNative) \ |
| 180 | SC(for_in, V8.ForIn) \ |
lrn@chromium.org | 1af7e1b | 2010-06-07 11:12:01 +0000 | [diff] [blame] | 181 | SC(memcopy_aligned, V8.MemCopyAligned) \ |
| 182 | SC(memcopy_unaligned, V8.MemCopyUnaligned) \ |
| 183 | SC(memcopy_noxmm, V8.MemCopyNoXMM) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 184 | SC(enum_cache_hits, V8.EnumCacheHits) \ |
| 185 | SC(enum_cache_misses, V8.EnumCacheMisses) \ |
| 186 | SC(reloc_info_count, V8.RelocInfoCount) \ |
| 187 | SC(reloc_info_size, V8.RelocInfoSize) \ |
| 188 | SC(zone_segment_bytes, V8.ZoneSegmentBytes) \ |
| 189 | SC(compute_entry_frame, V8.ComputeEntryFrame) \ |
| 190 | SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \ |
| 191 | SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) \ |
| 192 | SC(string_add_runtime, V8.StringAddRuntime) \ |
| 193 | SC(string_add_native, V8.StringAddNative) \ |
ricow@chromium.org | aa1b616 | 2010-03-29 07:44:58 +0000 | [diff] [blame] | 194 | SC(string_add_runtime_ext_to_ascii, V8.StringAddRuntimeExtToAscii) \ |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 195 | SC(sub_string_runtime, V8.SubStringRuntime) \ |
| 196 | SC(sub_string_native, V8.SubStringNative) \ |
| 197 | SC(string_compare_native, V8.StringCompareNative) \ |
| 198 | SC(string_compare_runtime, V8.StringCompareRuntime) \ |
| 199 | SC(regexp_entry_runtime, V8.RegExpEntryRuntime) \ |
| 200 | SC(regexp_entry_native, V8.RegExpEntryNative) \ |
| 201 | SC(number_to_string_native, V8.NumberToStringNative) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 202 | SC(number_to_string_runtime, V8.NumberToStringRuntime) \ |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 203 | SC(math_acos, V8.MathAcos) \ |
| 204 | SC(math_asin, V8.MathAsin) \ |
| 205 | SC(math_atan, V8.MathAtan) \ |
| 206 | SC(math_atan2, V8.MathAtan2) \ |
| 207 | SC(math_ceil, V8.MathCeil) \ |
| 208 | SC(math_cos, V8.MathCos) \ |
| 209 | SC(math_exp, V8.MathExp) \ |
| 210 | SC(math_floor, V8.MathFloor) \ |
| 211 | SC(math_log, V8.MathLog) \ |
| 212 | SC(math_pow, V8.MathPow) \ |
| 213 | SC(math_round, V8.MathRound) \ |
| 214 | SC(math_sin, V8.MathSin) \ |
| 215 | SC(math_sqrt, V8.MathSqrt) \ |
| 216 | SC(math_tan, V8.MathTan) \ |
| 217 | SC(transcendental_cache_hit, V8.TranscendentalCacheHit) \ |
| 218 | SC(transcendental_cache_miss, V8.TranscendentalCacheMiss) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 219 | |
kmillikin@chromium.org | 5d8f0e6 | 2010-03-24 08:21:20 +0000 | [diff] [blame] | 220 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 221 | // This file contains all the v8 counters that are in use. |
| 222 | class Counters : AllStatic { |
| 223 | public: |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 224 | #define HT(name, caption) \ |
| 225 | static HistogramTimer name; |
| 226 | HISTOGRAM_TIMER_LIST(HT) |
| 227 | #undef HT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 228 | |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 229 | #define SC(name, caption) \ |
| 230 | static StatsCounter name; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 231 | STATS_COUNTER_LIST_1(SC) |
| 232 | STATS_COUNTER_LIST_2(SC) |
| 233 | #undef SC |
| 234 | |
| 235 | enum Id { |
| 236 | #define RATE_ID(name, caption) k_##name, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 237 | HISTOGRAM_TIMER_LIST(RATE_ID) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 238 | #undef RATE_ID |
| 239 | #define COUNTER_ID(name, caption) k_##name, |
| 240 | STATS_COUNTER_LIST_1(COUNTER_ID) |
| 241 | STATS_COUNTER_LIST_2(COUNTER_ID) |
| 242 | #undef COUNTER_ID |
| 243 | #define COUNTER_ID(name) k_##name, |
| 244 | STATE_TAG_LIST(COUNTER_ID) |
| 245 | #undef COUNTER_ID |
| 246 | stats_counter_count |
| 247 | }; |
| 248 | |
| 249 | // Sliding state window counters. |
| 250 | static StatsCounter state_counters[]; |
| 251 | }; |
| 252 | |
| 253 | } } // namespace v8::internal |
| 254 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 255 | #endif // V8_V8_COUNTERS_H_ |