| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 1 | // Copyright 2007-2008 the V8 project authors. All rights reserved. |
| 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 | |
| 33 | namespace v8 { |
| 34 | namespace internal { |
| 35 | |
| 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) \ |
| Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame^] | 55 | HT(deferred_code_generation, V8.DeferredCodeGeneration) |
| 56 | |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +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. |
| 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 | /* Current amount of memory in external string buffers. */ \ |
| 78 | SC(total_external_string_memory, V8.TotalExternalStringMemory) \ |
| 79 | SC(script_wrappers, V8.ScriptWrappers) \ |
| 80 | SC(call_initialize_stubs, V8.CallInitializeStubs) \ |
| 81 | SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs) \ |
| 82 | SC(call_normal_stubs, V8.CallNormalStubs) \ |
| 83 | SC(call_megamorphic_stubs, V8.CallMegamorphicStubs) \ |
| 84 | SC(arguments_adaptors, V8.ArgumentsAdaptors) \ |
| 85 | SC(compilation_cache_hits, V8.CompilationCacheHits) \ |
| 86 | SC(compilation_cache_misses, V8.CompilationCacheMisses) \ |
| 87 | SC(regexp_cache_hits, V8.RegExpCacheHits) \ |
| 88 | SC(regexp_cache_misses, V8.RegExpCacheMisses) \ |
| 89 | /* Amount of evaled source code. */ \ |
| 90 | SC(total_eval_size, V8.TotalEvalSize) \ |
| 91 | /* Amount of loaded source code. */ \ |
| 92 | SC(total_load_size, V8.TotalLoadSize) \ |
| 93 | /* Amount of parsed source code. */ \ |
| 94 | SC(total_parse_size, V8.TotalParseSize) \ |
| 95 | /* Amount of source code skipped over using preparsing. */ \ |
| 96 | SC(total_preparse_skipped, V8.TotalPreparseSkipped) \ |
| 97 | /* Amount of compiled source code. */ \ |
| 98 | SC(total_compile_size, V8.TotalCompileSize) |
| 99 | |
| 100 | |
| 101 | #define STATS_COUNTER_LIST_2(SC) \ |
| 102 | /* Number of code stubs. */ \ |
| 103 | SC(code_stubs, V8.CodeStubs) \ |
| 104 | /* Amount of stub code. */ \ |
| 105 | SC(total_stubs_code_size, V8.TotalStubsCodeSize) \ |
| 106 | /* Amount of (JS) compiled code. */ \ |
| 107 | SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \ |
| 108 | SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \ |
| 109 | SC(gc_compactor_caused_by_promoted_data, \ |
| 110 | V8.GCCompactorCausedByPromotedData) \ |
| 111 | SC(gc_compactor_caused_by_oldspace_exhaustion, \ |
| 112 | V8.GCCompactorCausedByOldspaceExhaustion) \ |
| 113 | SC(gc_compactor_caused_by_weak_handles, \ |
| 114 | V8.GCCompactorCausedByWeakHandles) \ |
| 115 | SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \ |
| 116 | SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \ |
| 117 | /* How is the generic keyed-load stub used? */ \ |
| 118 | SC(keyed_load_generic_smi, V8.KeyedLoadGenericSmi) \ |
| 119 | SC(keyed_load_generic_symbol, V8.KeyedLoadGenericSymbol) \ |
| 120 | SC(keyed_load_generic_slow, V8.KeyedLoadGenericSlow) \ |
| Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame^] | 121 | SC(keyed_load_external_array_slow, V8.KeyedLoadExternalArraySlow) \ |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 122 | /* Count how much the monomorphic keyed-load stubs are hit. */ \ |
| 123 | SC(keyed_load_function_prototype, V8.KeyedLoadFunctionPrototype) \ |
| 124 | SC(keyed_load_string_length, V8.KeyedLoadStringLength) \ |
| 125 | SC(keyed_load_array_length, V8.KeyedLoadArrayLength) \ |
| 126 | SC(keyed_load_constant_function, V8.KeyedLoadConstantFunction) \ |
| 127 | SC(keyed_load_field, V8.KeyedLoadField) \ |
| 128 | SC(keyed_load_callback, V8.KeyedLoadCallback) \ |
| 129 | SC(keyed_load_interceptor, V8.KeyedLoadInterceptor) \ |
| 130 | SC(keyed_load_inline, V8.KeyedLoadInline) \ |
| 131 | SC(keyed_load_inline_miss, V8.KeyedLoadInlineMiss) \ |
| 132 | SC(named_load_inline, V8.NamedLoadInline) \ |
| 133 | SC(named_load_inline_miss, V8.NamedLoadInlineMiss) \ |
| 134 | SC(named_load_global_inline, V8.NamedLoadGlobalInline) \ |
| 135 | SC(named_load_global_inline_miss, V8.NamedLoadGlobalInlineMiss) \ |
| 136 | SC(keyed_store_field, V8.KeyedStoreField) \ |
| 137 | SC(keyed_store_inline, V8.KeyedStoreInline) \ |
| 138 | SC(keyed_store_inline_miss, V8.KeyedStoreInlineMiss) \ |
| 139 | SC(named_store_global_inline, V8.NamedStoreGlobalInline) \ |
| 140 | SC(named_store_global_inline_miss, V8.NamedStoreGlobalInlineMiss) \ |
| 141 | SC(call_global_inline, V8.CallGlobalInline) \ |
| 142 | SC(call_global_inline_miss, V8.CallGlobalInlineMiss) \ |
| 143 | SC(constructed_objects, V8.ConstructedObjects) \ |
| 144 | SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \ |
| 145 | SC(constructed_objects_stub, V8.ConstructedObjectsStub) \ |
| 146 | SC(array_function_runtime, V8.ArrayFunctionRuntime) \ |
| 147 | SC(array_function_native, V8.ArrayFunctionNative) \ |
| 148 | SC(for_in, V8.ForIn) \ |
| 149 | SC(enum_cache_hits, V8.EnumCacheHits) \ |
| 150 | SC(enum_cache_misses, V8.EnumCacheMisses) \ |
| 151 | SC(reloc_info_count, V8.RelocInfoCount) \ |
| 152 | SC(reloc_info_size, V8.RelocInfoSize) \ |
| 153 | SC(zone_segment_bytes, V8.ZoneSegmentBytes) \ |
| Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame^] | 154 | SC(compute_entry_frame, V8.ComputeEntryFrame) \ |
| 155 | SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \ |
| 156 | SC(generic_binary_stub_calls_regs, V8.GenericBinaryStubCallsRegs) |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 157 | |
| 158 | |
| 159 | // This file contains all the v8 counters that are in use. |
| 160 | class Counters : AllStatic { |
| 161 | public: |
| 162 | #define HT(name, caption) \ |
| 163 | static HistogramTimer name; |
| 164 | HISTOGRAM_TIMER_LIST(HT) |
| 165 | #undef HT |
| 166 | |
| 167 | #define SC(name, caption) \ |
| 168 | static StatsCounter name; |
| 169 | STATS_COUNTER_LIST_1(SC) |
| 170 | STATS_COUNTER_LIST_2(SC) |
| 171 | #undef SC |
| 172 | |
| 173 | enum Id { |
| 174 | #define RATE_ID(name, caption) k_##name, |
| 175 | HISTOGRAM_TIMER_LIST(RATE_ID) |
| 176 | #undef RATE_ID |
| 177 | #define COUNTER_ID(name, caption) k_##name, |
| 178 | STATS_COUNTER_LIST_1(COUNTER_ID) |
| 179 | STATS_COUNTER_LIST_2(COUNTER_ID) |
| 180 | #undef COUNTER_ID |
| 181 | #define COUNTER_ID(name) k_##name, |
| 182 | STATE_TAG_LIST(COUNTER_ID) |
| 183 | #undef COUNTER_ID |
| 184 | stats_counter_count |
| 185 | }; |
| 186 | |
| 187 | // Sliding state window counters. |
| 188 | static StatsCounter state_counters[]; |
| 189 | }; |
| 190 | |
| 191 | } } // namespace v8::internal |
| 192 | |
| 193 | #endif // V8_V8_COUNTERS_H_ |