8 #include "include/v8.h" 9 #include "src/allocation.h" 10 #include "src/base/atomic-utils.h" 11 #include "src/base/platform/elapsed-timer.h" 12 #include "src/base/platform/time.h" 13 #include "src/globals.h" 14 #include "src/heap-symbols.h" 15 #include "src/isolate.h" 16 #include "src/objects.h" 17 #include "src/runtime/runtime.h" 18 #include "src/tracing/trace-event.h" 19 #include "src/tracing/traced-value.h" 20 #include "src/tracing/tracing-category-observer.h" 35 void SetCounterFunction(CounterLookupCallback f);
39 void SetCreateHistogramFunction(CreateHistogramCallback f) {
40 create_histogram_function_ = f;
45 void SetAddHistogramSampleFunction(AddHistogramSampleCallback f) {
46 add_histogram_sample_function_ = f;
49 bool HasCounterFunction()
const {
return lookup_function_ !=
nullptr; }
57 int* FindLocation(
const char* name) {
58 if (!lookup_function_)
return nullptr;
59 return lookup_function_(name);
67 void* CreateHistogram(
const char* name,
71 if (!create_histogram_function_)
return nullptr;
72 return create_histogram_function_(name, min, max, buckets);
77 void AddHistogramSample(
void* histogram,
int sample) {
78 if (!add_histogram_sample_function_)
return;
79 return add_histogram_sample_function_(histogram, sample);
87 CounterLookupCallback lookup_function_;
88 CreateHistogramCallback create_histogram_function_;
89 AddHistogramSampleCallback add_histogram_sample_function_;
103 : counters_(counters), name_(name), ptr_(
nullptr) {}
105 void SetLoc(
int* loc,
int value) { *loc = value; }
106 void IncrementLoc(
int* loc) { (*loc)++; }
107 void IncrementLoc(
int* loc,
int value) { (*loc) += value; }
108 void DecrementLoc(
int* loc) { (*loc)--; }
109 void DecrementLoc(
int* loc,
int value) { (*loc) -= value; }
111 int* FindLocationInStatsTable()
const;
126 void Set(
int value) {
127 if (
int* loc = GetPtr()) SetLoc(loc, value);
132 if (
int* loc = GetPtr()) IncrementLoc(loc);
135 void Increment(
int value) {
136 if (
int* loc = GetPtr()) IncrementLoc(loc, value);
141 if (
int* loc = GetPtr()) DecrementLoc(loc);
144 void Decrement(
int value) {
145 if (
int* loc = GetPtr()) DecrementLoc(loc, value);
150 bool Enabled() {
return GetPtr() !=
nullptr; }
155 int* GetInternalPointer() {
157 DCHECK_NOT_NULL(loc);
169 void Reset() { lookup_done_ =
false; }
173 if (lookup_done_)
return ptr_;
175 ptr_ = FindLocationInStatsTable();
187 void Increment(
int value);
189 void Decrement(
int value);
190 bool Enabled() {
return ptr_ !=
nullptr; }
191 int* GetInternalPointer() {
192 DCHECK_NOT_NULL(ptr_);
200 void Reset() { ptr_ = FindLocationInStatsTable(); }
212 void AddSample(
int sample);
215 bool Enabled() {
return histogram_ !=
nullptr; }
217 const char* name() {
return name_; }
219 int min()
const {
return min_; }
220 int max()
const {
return max_; }
221 int num_buckets()
const {
return num_buckets_; }
225 void AssertReportsToCounters(
Counters* expected_counters) {
226 DCHECK_EQ(counters_, expected_counters);
231 Histogram(
const char* name,
int min,
int max,
int num_buckets,
236 num_buckets_(num_buckets),
238 counters_(counters) {
242 Counters* counters()
const {
return counters_; }
245 void Reset() { histogram_ = CreateHistogram(); }
250 void* CreateHistogram()
const;
260 enum class HistogramTimerResolution { MILLISECOND, MICROSECOND };
278 HistogramTimerResolution resolution_;
282 HistogramTimerResolution resolution,
int num_buckets,
284 :
Histogram(name, min, max, num_buckets, counters),
285 resolution_(resolution) {}
286 void AddTimeSample();
294 : histogram_(histogram), isolate_(isolate) {
295 histogram_->Start(&timer_, isolate);
308 enum class OptionalTimedHistogramScopeMode { TAKE_TIME, DONT_TAKE_TIME };
315 OptionalTimedHistogramScopeMode mode)
316 : histogram_(histogram), isolate_(isolate), mode_(mode) {
317 if (mode == OptionalTimedHistogramScopeMode::TAKE_TIME) {
318 histogram_->Start(&timer_, isolate);
323 if (mode_ == OptionalTimedHistogramScopeMode::TAKE_TIME) {
324 histogram_->Stop(&timer_, isolate_);
332 const OptionalTimedHistogramScopeMode mode_;
347 std::shared_ptr<Counters> async_counters)
348 : histogram_(histogram), async_counters_(std::move(async_counters)) {
349 histogram_->AssertReportsToCounters(async_counters_.get());
350 histogram_->Start(&timer_,
nullptr);
361 void RecordDone() { histogram_->Stop(&timer_,
nullptr); }
364 void RecordAbandon() { histogram_->RecordAbandon(&timer_,
nullptr); }
369 std::shared_ptr<Counters> async_counters_;
384 DCHECK_NOT_NULL(histogram_);
385 histogram_->Stop(&timer_,
nullptr);
388 void set_histogram(
TimedHistogram* histogram) { histogram_ = histogram; }
402 HistogramTimerResolution resolution,
int num_buckets,
404 :
TimedHistogram(name, min, max, resolution, num_buckets, counters) {}
411 return Enabled() && timer_.IsStarted();
435 bool allow_nesting =
false)
437 : timer_(timer), skipped_timer_start_(
false) {
438 if (timer_->timer()->IsStarted() && allow_nesting) {
439 skipped_timer_start_ =
true;
451 if (!skipped_timer_start_) {
462 bool skipped_timer_start_;
487 AddSample(static_cast<int>(time_.InMicroseconds()));
499 int num_buckets,
Counters* counters)
500 :
Histogram(name, min, max, num_buckets, counters) {}
511 : histogram_(histogram) {
525 : histogram_(histogram) {
545 template <
typename Histogram>
551 backing_histogram_ = backing_histogram;
563 void AddSample(
double current_ms,
double current_value);
569 : is_initialized_(
false),
572 aggregate_value_(0.0),
574 backing_histogram_(
nullptr) {}
575 double Aggregate(
double current_ms,
double current_value);
577 bool is_initialized_;
580 double aggregate_value_;
586 template <
typename Histogram>
588 double current_value) {
589 if (!is_initialized_) {
590 aggregate_value_ = current_value;
591 start_ms_ = current_ms;
592 last_value_ = current_value;
593 last_ms_ = current_ms;
594 is_initialized_ =
true;
596 const double kEpsilon = 1e-6;
597 const int kMaxSamples = 1000;
598 if (current_ms < last_ms_ + kEpsilon) {
600 last_value_ = current_value;
602 double sample_interval_ms = FLAG_histogram_interval;
603 double end_ms = start_ms_ + sample_interval_ms;
604 if (end_ms <= current_ms + kEpsilon) {
606 double slope = (current_value - last_value_) / (current_ms - last_ms_);
610 for (
i = 0;
i < kMaxSamples && end_ms <= current_ms + kEpsilon;
i++) {
611 double end_value = last_value_ + (end_ms - last_ms_) * slope;
615 sample_value = Aggregate(end_ms, end_value);
618 sample_value = (last_value_ + end_value) / 2;
620 backing_histogram_->AddSample(static_cast<int>(sample_value + 0.5));
621 last_value_ = end_value;
623 end_ms += sample_interval_ms;
625 if (
i == kMaxSamples) {
627 aggregate_value_ = current_value;
628 start_ms_ = current_ms;
630 aggregate_value_ = last_value_;
631 start_ms_ = last_ms_;
634 aggregate_value_ = current_ms > start_ms_ + kEpsilon
635 ? Aggregate(current_ms, current_value)
637 last_value_ = current_value;
638 last_ms_ = current_ms;
644 template <
typename Histogram>
645 double AggregatedMemoryHistogram<Histogram>::Aggregate(
double current_ms,
646 double current_value) {
647 double interval_ms = current_ms - start_ms_;
648 double value = (current_value + last_value_) / 2;
652 return aggregate_value_ * ((last_ms_ - start_ms_) / interval_ms) +
653 value * ((current_ms - last_ms_) / interval_ms);
660 : name_(name), count_(0), time_(0) {}
661 V8_NOINLINE
void Reset();
665 const char* name()
const {
return name_; }
666 int64_t count()
const {
return count_; }
668 return base::TimeDelta::FromMicroseconds(time_);
670 void Increment() { count_++; }
690 const char* name()
const {
return counter_->name(); }
692 inline bool IsStarted();
704 inline void CommitTimeToCounter();
712 #define FOR_EACH_GC_COUNTER(V) \ 714 TRACER_BACKGROUND_SCOPES(V) 716 #define FOR_EACH_API_COUNTER(V) \ 717 V(ArrayBuffer_Cast) \ 718 V(ArrayBuffer_Neuter) \ 720 V(Array_CloneElementAt) \ 722 V(BigInt_NewFromWords) \ 723 V(BigInt64Array_New) \ 724 V(BigUint64Array_New) \ 725 V(BigIntObject_New) \ 726 V(BigIntObject_BigIntValue) \ 727 V(BooleanObject_BooleanValue) \ 728 V(BooleanObject_New) \ 730 V(Context_NewRemoteContext) \ 732 V(Date_DateTimeConfigurationChangeNotification) \ 734 V(Date_NumberValue) \ 738 V(Float32Array_New) \ 739 V(Float64Array_New) \ 742 V(Function_NewInstance) \ 743 V(FunctionTemplate_GetFunction) \ 744 V(FunctionTemplate_New) \ 745 V(FunctionTemplate_NewRemoteInstance) \ 746 V(FunctionTemplate_NewWithCache) \ 747 V(FunctionTemplate_NewWithFastHandler) \ 763 V(Message_GetEndColumn) \ 764 V(Message_GetLineNumber) \ 765 V(Message_GetSourceLine) \ 766 V(Message_GetStartColumn) \ 768 V(Module_InstantiateModule) \ 769 V(NumberObject_New) \ 770 V(NumberObject_NumberValue) \ 771 V(Object_CallAsConstructor) \ 772 V(Object_CallAsFunction) \ 773 V(Object_CreateDataProperty) \ 774 V(Object_DefineOwnProperty) \ 775 V(Object_DefineProperty) \ 777 V(Object_DeleteProperty) \ 780 V(Object_GetOwnPropertyDescriptor) \ 781 V(Object_GetOwnPropertyNames) \ 782 V(Object_GetPropertyAttributes) \ 783 V(Object_GetPropertyNames) \ 784 V(Object_GetRealNamedProperty) \ 785 V(Object_GetRealNamedPropertyAttributes) \ 786 V(Object_GetRealNamedPropertyAttributesInPrototypeChain) \ 787 V(Object_GetRealNamedPropertyInPrototypeChain) \ 789 V(Object_HasOwnProperty) \ 790 V(Object_HasRealIndexedProperty) \ 791 V(Object_HasRealNamedCallbackProperty) \ 792 V(Object_HasRealNamedProperty) \ 794 V(Object_ObjectProtoToString) \ 796 V(Object_SetAccessor) \ 797 V(Object_SetIntegrityLevel) \ 798 V(Object_SetPrivate) \ 799 V(Object_SetPrototype) \ 800 V(ObjectTemplate_New) \ 801 V(ObjectTemplate_NewInstance) \ 802 V(Object_ToArrayIndex) \ 804 V(Object_ToDetailString) \ 806 V(Object_ToInteger) \ 815 V(Promise_HasRejectHandler) \ 816 V(Promise_Resolver_New) \ 817 V(Promise_Resolver_Resolve) \ 818 V(Promise_Resolver_Reject) \ 824 V(ReferenceError_New) \ 826 V(ScriptCompiler_Compile) \ 827 V(ScriptCompiler_CompileFunctionInContext) \ 828 V(ScriptCompiler_CompileUnbound) \ 836 V(SharedArrayBuffer_New) \ 838 V(String_NewExternalOneByte) \ 839 V(String_NewExternalTwoByte) \ 840 V(String_NewFromOneByte) \ 841 V(String_NewFromTwoByte) \ 842 V(String_NewFromUtf8) \ 843 V(StringObject_New) \ 844 V(StringObject_StringValue) \ 846 V(String_WriteUtf8) \ 848 V(SymbolObject_New) \ 849 V(SymbolObject_SymbolValue) \ 851 V(TryCatch_StackTrace) \ 856 V(Uint8ClampedArray_New) \ 857 V(UnboundScript_GetId) \ 858 V(UnboundScript_GetLineNumber) \ 859 V(UnboundScript_GetName) \ 860 V(UnboundScript_GetSourceMappingURL) \ 861 V(UnboundScript_GetSourceURL) \ 862 V(Value_InstanceOf) \ 863 V(Value_IntegerValue) \ 864 V(Value_Int32Value) \ 865 V(Value_NumberValue) \ 867 V(Value_Uint32Value) \ 868 V(ValueDeserializer_ReadHeader) \ 869 V(ValueDeserializer_ReadValue) \ 870 V(ValueSerializer_WriteValue) 872 #define FOR_EACH_MANUAL_COUNTER(V) \ 873 V(AccessorGetterCallback) \ 874 V(AccessorSetterCallback) \ 875 V(ArrayLengthGetter) \ 876 V(ArrayLengthSetter) \ 877 V(BoundFunctionNameGetter) \ 878 V(BoundFunctionLengthGetter) \ 879 V(CompileBackgroundAnalyse) \ 880 V(CompileBackgroundCompileTask) \ 881 V(CompileBackgroundEval) \ 882 V(CompileBackgroundFunction) \ 883 V(CompileBackgroundIgnition) \ 884 V(CompileBackgroundScript) \ 885 V(CompileBackgroundRewriteReturnResult) \ 886 V(CompileBackgroundScopeAnalysis) \ 887 V(CompileDeserialize) \ 890 V(CompileEnqueueOnDispatcher) \ 891 V(CompileFinalizeBackgroundCompileTask) \ 892 V(CompileFinishNowOnDispatcher) \ 894 V(CompileGetFromOptimizedCodeMap) \ 896 V(CompileIgnitionFinalization) \ 897 V(CompileRewriteReturnResult) \ 898 V(CompileScopeAnalysis) \ 900 V(CompileSerialize) \ 901 V(CompileWaitForDispatcher) \ 903 V(FunctionCallback) \ 904 V(FunctionPrototypeGetter) \ 905 V(FunctionPrototypeSetter) \ 906 V(FunctionLengthGetter) \ 907 V(GC_Custom_AllAvailableGarbage) \ 908 V(GC_Custom_IncrementalMarkingObserver) \ 909 V(GC_Custom_SlowAllocateRaw) \ 910 V(GCEpilogueCallback) \ 911 V(GCPrologueCallback) \ 912 V(GetMoreDataCallback) \ 913 V(NamedDefinerCallback) \ 914 V(NamedDeleterCallback) \ 915 V(NamedDescriptorCallback) \ 916 V(NamedQueryCallback) \ 917 V(NamedSetterCallback) \ 918 V(NamedGetterCallback) \ 919 V(NamedEnumeratorCallback) \ 920 V(IndexedDefinerCallback) \ 921 V(IndexedDeleterCallback) \ 922 V(IndexedDescriptorCallback) \ 923 V(IndexedGetterCallback) \ 924 V(IndexedQueryCallback) \ 925 V(IndexedSetterCallback) \ 926 V(IndexedEnumeratorCallback) \ 927 V(InvokeApiInterruptCallbacks) \ 928 V(InvokeFunctionCallback) \ 930 V(Map_SetPrototype) \ 931 V(Map_TransitionToAccessorProperty) \ 932 V(Map_TransitionToDataProperty) \ 933 V(Object_DeleteProperty) \ 935 V(ParseArrowFunctionLiteral) \ 936 V(ParseBackgroundArrowFunctionLiteral) \ 937 V(ParseBackgroundFunctionLiteral) \ 938 V(ParseBackgroundProgram) \ 941 V(ParseFunctionLiteral) \ 943 V(PreParseArrowFunctionLiteral) \ 944 V(PreParseBackgroundArrowFunctionLiteral) \ 945 V(PreParseBackgroundWithVariableResolution) \ 946 V(PreParseWithVariableResolution) \ 947 V(PropertyCallback) \ 948 V(PrototypeMap_TransitionToAccessorProperty) \ 949 V(PrototypeMap_TransitionToDataProperty) \ 950 V(PrototypeObject_DeleteProperty) \ 951 V(RecompileConcurrent) \ 952 V(RecompileSynchronous) \ 953 V(ReconfigureToDataProperty) \ 954 V(StringLengthGetter) \ 959 #define FOR_EACH_HANDLER_COUNTER(V) \ 960 V(KeyedLoadIC_LoadIndexedInterceptorStub) \ 961 V(KeyedLoadIC_KeyedLoadSloppyArgumentsStub) \ 962 V(KeyedLoadIC_LoadElementDH) \ 963 V(KeyedLoadIC_LoadIndexedStringDH) \ 964 V(KeyedLoadIC_SlowStub) \ 965 V(KeyedStoreIC_ElementsTransitionAndStoreStub) \ 966 V(KeyedStoreIC_KeyedStoreSloppyArgumentsStub) \ 967 V(KeyedStoreIC_SlowStub) \ 968 V(KeyedStoreIC_StoreFastElementStub) \ 969 V(KeyedStoreIC_StoreElementStub) \ 970 V(StoreInArrayLiteralIC_SlowStub) \ 971 V(LoadGlobalIC_LoadScriptContextField) \ 972 V(LoadGlobalIC_SlowStub) \ 973 V(LoadIC_FunctionPrototypeStub) \ 974 V(LoadIC_HandlerCacheHit_Accessor) \ 975 V(LoadIC_LoadAccessorDH) \ 976 V(LoadIC_LoadAccessorFromPrototypeDH) \ 977 V(LoadIC_LoadApiGetterFromPrototypeDH) \ 978 V(LoadIC_LoadCallback) \ 979 V(LoadIC_LoadConstantDH) \ 980 V(LoadIC_LoadConstantFromPrototypeDH) \ 981 V(LoadIC_LoadFieldDH) \ 982 V(LoadIC_LoadFieldFromPrototypeDH) \ 983 V(LoadIC_LoadGlobalDH) \ 984 V(LoadIC_LoadGlobalFromPrototypeDH) \ 985 V(LoadIC_LoadIntegerIndexedExoticDH) \ 986 V(LoadIC_LoadInterceptorDH) \ 987 V(LoadIC_LoadNonMaskingInterceptorDH) \ 988 V(LoadIC_LoadInterceptorFromPrototypeDH) \ 989 V(LoadIC_LoadNativeDataPropertyDH) \ 990 V(LoadIC_LoadNativeDataPropertyFromPrototypeDH) \ 991 V(LoadIC_LoadNonexistentDH) \ 992 V(LoadIC_LoadNormalDH) \ 993 V(LoadIC_LoadNormalFromPrototypeDH) \ 994 V(LoadIC_NonReceiver) \ 995 V(LoadIC_Premonomorphic) \ 997 V(LoadIC_StringLength) \ 998 V(LoadIC_StringWrapperLength) \ 999 V(StoreGlobalIC_StoreScriptContextField) \ 1000 V(StoreGlobalIC_SlowStub) \ 1001 V(StoreIC_HandlerCacheHit_Accessor) \ 1002 V(StoreIC_NonReceiver) \ 1003 V(StoreIC_Premonomorphic) \ 1004 V(StoreIC_SlowStub) \ 1005 V(StoreIC_StoreAccessorDH) \ 1006 V(StoreIC_StoreAccessorOnPrototypeDH) \ 1007 V(StoreIC_StoreApiSetterOnPrototypeDH) \ 1008 V(StoreIC_StoreFieldDH) \ 1009 V(StoreIC_StoreGlobalDH) \ 1010 V(StoreIC_StoreGlobalTransitionDH) \ 1011 V(StoreIC_StoreInterceptorStub) \ 1012 V(StoreIC_StoreNativeDataPropertyDH) \ 1013 V(StoreIC_StoreNativeDataPropertyOnPrototypeDH) \ 1014 V(StoreIC_StoreNormalDH) \ 1015 V(StoreIC_StoreTransitionDH) 1017 enum RuntimeCallCounterId {
1018 #define CALL_RUNTIME_COUNTER(name) kGC_##name, 1019 FOR_EACH_GC_COUNTER(CALL_RUNTIME_COUNTER)
1020 #undef CALL_RUNTIME_COUNTER 1021 #define CALL_RUNTIME_COUNTER(name) k##name, 1022 FOR_EACH_MANUAL_COUNTER(CALL_RUNTIME_COUNTER)
1023 #undef CALL_RUNTIME_COUNTER 1024 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) kRuntime_##name, 1025 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
1026 #undef CALL_RUNTIME_COUNTER 1027 #define CALL_BUILTIN_COUNTER(name) kBuiltin_##name, 1028 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
1029 #undef CALL_BUILTIN_COUNTER 1030 #define CALL_BUILTIN_COUNTER(name) kAPI_##name, 1031 FOR_EACH_API_COUNTER(CALL_BUILTIN_COUNTER)
1032 #undef CALL_BUILTIN_COUNTER 1033 #define CALL_BUILTIN_COUNTER(name) kHandler_##name, 1034 FOR_EACH_HANDLER_COUNTER(CALL_BUILTIN_COUNTER)
1035 #undef CALL_BUILTIN_COUNTER 1046 RuntimeCallCounterId counter_id);
1055 V8_EXPORT_PRIVATE
void CorrectCurrentCounterId(
1056 RuntimeCallCounterId counter_id);
1058 V8_EXPORT_PRIVATE
void Reset();
1061 V8_EXPORT_PRIVATE
void Print(std::ostream& os);
1062 V8_EXPORT_PRIVATE
void Print();
1065 ThreadId thread_id()
const {
return thread_id_; }
1068 bool InUse() {
return in_use_; }
1069 bool IsCalledOnTheSameThread();
1071 static const int kNumberOfCounters =
1072 static_cast<int>(RuntimeCallCounterId::kNumberOfCounters);
1074 return &counters_[
static_cast<int>(counter_id)];
1077 return &counters_[counter_id];
1097 base::Thread::LocalStorageKey GetKey()
const {
return tls_key_; }
1108 std::vector<std::unique_ptr<RuntimeCallStats>> tables_;
1109 base::Thread::LocalStorageKey tls_key_;
1127 #define CHANGE_CURRENT_RUNTIME_COUNTER(runtime_call_stats, counter_id) \ 1129 if (V8_UNLIKELY(FLAG_runtime_stats) && runtime_call_stats) { \ 1130 runtime_call_stats->CorrectCurrentCounterId(counter_id); \ 1134 #define TRACE_HANDLER_STATS(isolate, counter_name) \ 1135 CHANGE_CURRENT_RUNTIME_COUNTER( \ 1136 isolate->counters()->runtime_call_stats(), \ 1137 RuntimeCallCounterId::kHandler_##counter_name) 1144 RuntimeCallCounterId counter_id);
1148 RuntimeCallCounterId counter_id);
1150 RuntimeCallCounterId counter_id) {
1151 if (V8_LIKELY(!FLAG_runtime_stats || stats ==
nullptr))
return;
1153 stats_->Enter(&timer_, counter_id);
1157 if (V8_UNLIKELY(stats_ !=
nullptr)) {
1158 stats_->Leave(&timer_);
1169 #define HISTOGRAM_RANGE_LIST(HR) \ 1171 HR(background_marking, V8.GCBackgroundMarking, 0, 10000, 101) \ 1172 HR(background_scavenger, V8.GCBackgroundScavenger, 0, 10000, 101) \ 1173 HR(background_sweeping, V8.GCBackgroundSweeping, 0, 10000, 101) \ 1174 HR(detached_context_age_in_gc, V8.DetachedContextAgeInGC, 0, 20, 21) \ 1175 HR(code_cache_reject_reason, V8.CodeCacheRejectReason, 1, 6, 6) \ 1176 HR(errors_thrown_per_context, V8.ErrorsThrownPerContext, 0, 200, 20) \ 1177 HR(debug_feature_usage, V8.DebugFeatureUsage, 1, 7, 7) \ 1178 HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0, 21, 22) \ 1179 HR(incremental_marking_sum, V8.GCIncrementalMarkingSum, 0, 10000, 101) \ 1180 HR(mark_compact_reason, V8.GCMarkCompactReason, 0, 21, 22) \ 1181 HR(gc_finalize_clear, V8.GCFinalizeMC.Clear, 0, 10000, 101) \ 1182 HR(gc_finalize_epilogue, V8.GCFinalizeMC.Epilogue, 0, 10000, 101) \ 1183 HR(gc_finalize_evacuate, V8.GCFinalizeMC.Evacuate, 0, 10000, 101) \ 1184 HR(gc_finalize_finish, V8.GCFinalizeMC.Finish, 0, 10000, 101) \ 1185 HR(gc_finalize_mark, V8.GCFinalizeMC.Mark, 0, 10000, 101) \ 1186 HR(gc_finalize_prologue, V8.GCFinalizeMC.Prologue, 0, 10000, 101) \ 1187 HR(gc_finalize_sweep, V8.GCFinalizeMC.Sweep, 0, 10000, 101) \ 1188 HR(gc_scavenger_scavenge_main, V8.GCScavenger.ScavengeMain, 0, 10000, 101) \ 1189 HR(gc_scavenger_scavenge_roots, V8.GCScavenger.ScavengeRoots, 0, 10000, 101) \ 1190 HR(gc_mark_compactor, V8.GCMarkCompactor, 0, 10000, 101) \ 1191 HR(scavenge_reason, V8.GCScavengeReason, 0, 21, 22) \ 1192 HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3) \ 1194 HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 100000, \ 1196 HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1, \ 1198 HR(array_buffer_big_allocations, V8.ArrayBufferLargeAllocations, 0, 4096, \ 1200 HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096, \ 1202 HR(shared_array_allocations, V8.SharedArrayAllocationSizes, 0, 4096, 13) \ 1203 HR(wasm_asm_function_size_bytes, V8.WasmFunctionSizeBytes.asm, 1, GB, 51) \ 1204 HR(wasm_wasm_function_size_bytes, V8.WasmFunctionSizeBytes.wasm, 1, GB, 51) \ 1205 HR(wasm_asm_module_size_bytes, V8.WasmModuleSizeBytes.asm, 1, GB, 51) \ 1206 HR(wasm_wasm_module_size_bytes, V8.WasmModuleSizeBytes.wasm, 1, GB, 51) \ 1207 HR(wasm_asm_min_mem_pages_count, V8.WasmMinMemPagesCount.asm, 1, 2 << 16, \ 1209 HR(wasm_wasm_min_mem_pages_count, V8.WasmMinMemPagesCount.wasm, 1, 2 << 16, \ 1211 HR(wasm_wasm_max_mem_pages_count, V8.WasmMaxMemPagesCount.wasm, 1, 2 << 16, \ 1213 HR(wasm_decode_asm_module_peak_memory_bytes, \ 1214 V8.WasmDecodeModulePeakMemoryBytes.asm, 1, GB, 51) \ 1215 HR(wasm_decode_wasm_module_peak_memory_bytes, \ 1216 V8.WasmDecodeModulePeakMemoryBytes.wasm, 1, GB, 51) \ 1217 HR(asm_wasm_translation_peak_memory_bytes, \ 1218 V8.AsmWasmTranslationPeakMemoryBytes, 1, GB, 51) \ 1219 HR(wasm_compile_function_peak_memory_bytes, \ 1220 V8.WasmCompileFunctionPeakMemoryBytes, 1, GB, 51) \ 1221 HR(asm_module_size_bytes, V8.AsmModuleSizeBytes, 1, GB, 51) \ 1222 HR(asm_wasm_translation_throughput, V8.AsmWasmTranslationThroughput, 1, 100, \ 1224 HR(wasm_lazy_compilation_throughput, V8.WasmLazyCompilationThroughput, 1, \ 1226 HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 20, \ 1228 HR(wasm_memory_allocation_result, V8.WasmMemoryAllocationResult, 0, 3, 4) \ 1229 HR(wasm_address_space_usage_mb, V8.WasmAddressSpaceUsageMiB, 0, 1 << 20, \ 1231 HR(wasm_module_code_size_mb, V8.WasmModuleCodeSizeMiB, 0, 1024, 64) 1233 #define HISTOGRAM_TIMER_LIST(HT) \ 1235 HT(gc_context, V8.GCContext, 10000, \ 1237 HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND) \ 1238 HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND) \ 1239 HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000, \ 1241 HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000, \ 1243 HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000, \ 1246 HT(compile, V8.CompileMicroSeconds, 1000000, MICROSECOND) \ 1247 HT(compile_eval, V8.CompileEvalMicroSeconds, 1000000, MICROSECOND) \ 1249 HT(compile_serialize, V8.CompileSerializeMicroSeconds, 100000, MICROSECOND) \ 1250 HT(compile_deserialize, V8.CompileDeserializeMicroSeconds, 1000000, \ 1253 HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND) \ 1255 HT(execute, V8.Execute, 1000000, MICROSECOND) \ 1257 HT(asm_wasm_translation_time, V8.AsmWasmTranslationMicroSeconds, 1000000, \ 1259 HT(wasm_lazy_compilation_time, V8.WasmLazyCompilationMicroSeconds, 1000000, \ 1261 HT(wasm_execution_time, V8.WasmExecutionTimeMicroSeconds, 10000000, \ 1264 #define TIMED_HISTOGRAM_LIST(HT) \ 1266 HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND) \ 1267 HT(gc_compactor_background, V8.GCCompactorBackground, 10000, MILLISECOND) \ 1268 HT(gc_compactor_foreground, V8.GCCompactorForeground, 10000, MILLISECOND) \ 1269 HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND) \ 1270 HT(gc_finalize_background, V8.GCFinalizeMCBackground, 10000, MILLISECOND) \ 1271 HT(gc_finalize_foreground, V8.GCFinalizeMCForeground, 10000, MILLISECOND) \ 1272 HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000, \ 1274 HT(gc_finalize_reduce_memory_background, \ 1275 V8.GCFinalizeMCReduceMemoryBackground, 10000, MILLISECOND) \ 1276 HT(gc_finalize_reduce_memory_foreground, \ 1277 V8.GCFinalizeMCReduceMemoryForeground, 10000, MILLISECOND) \ 1278 HT(gc_scavenger, V8.GCScavenger, 10000, MILLISECOND) \ 1279 HT(gc_scavenger_background, V8.GCScavengerBackground, 10000, MILLISECOND) \ 1280 HT(gc_scavenger_foreground, V8.GCScavengerForeground, 10000, MILLISECOND) \ 1282 HT(wasm_decode_asm_module_time, V8.WasmDecodeModuleMicroSeconds.asm, \ 1283 1000000, MICROSECOND) \ 1284 HT(wasm_decode_wasm_module_time, V8.WasmDecodeModuleMicroSeconds.wasm, \ 1285 1000000, MICROSECOND) \ 1286 HT(wasm_decode_asm_function_time, V8.WasmDecodeFunctionMicroSeconds.asm, \ 1287 1000000, MICROSECOND) \ 1288 HT(wasm_decode_wasm_function_time, V8.WasmDecodeFunctionMicroSeconds.wasm, \ 1289 1000000, MICROSECOND) \ 1290 HT(wasm_compile_asm_module_time, V8.WasmCompileModuleMicroSeconds.asm, \ 1291 10000000, MICROSECOND) \ 1292 HT(wasm_compile_wasm_module_time, V8.WasmCompileModuleMicroSeconds.wasm, \ 1293 10000000, MICROSECOND) \ 1294 HT(wasm_compile_asm_function_time, V8.WasmCompileFunctionMicroSeconds.asm, \ 1295 1000000, MICROSECOND) \ 1296 HT(wasm_compile_wasm_function_time, V8.WasmCompileFunctionMicroSeconds.wasm, \ 1297 1000000, MICROSECOND) \ 1298 HT(liftoff_compile_time, V8.LiftoffCompileMicroSeconds, 10000000, \ 1300 HT(wasm_instantiate_wasm_module_time, \ 1301 V8.WasmInstantiateModuleMicroSeconds.wasm, 10000000, MICROSECOND) \ 1302 HT(wasm_instantiate_asm_module_time, \ 1303 V8.WasmInstantiateModuleMicroSeconds.asm, 10000000, MICROSECOND) \ 1305 HT(compile_script_with_produce_cache, \ 1306 V8.CompileScriptMicroSeconds.ProduceCache, 1000000, MICROSECOND) \ 1307 HT(compile_script_with_isolate_cache_hit, \ 1308 V8.CompileScriptMicroSeconds.IsolateCacheHit, 1000000, MICROSECOND) \ 1309 HT(compile_script_with_consume_cache, \ 1310 V8.CompileScriptMicroSeconds.ConsumeCache, 1000000, MICROSECOND) \ 1311 HT(compile_script_consume_failed, \ 1312 V8.CompileScriptMicroSeconds.ConsumeCache.Failed, 1000000, MICROSECOND) \ 1313 HT(compile_script_no_cache_other, \ 1314 V8.CompileScriptMicroSeconds.NoCache.Other, 1000000, MICROSECOND) \ 1315 HT(compile_script_no_cache_because_inline_script, \ 1316 V8.CompileScriptMicroSeconds.NoCache.InlineScript, 1000000, MICROSECOND) \ 1317 HT(compile_script_no_cache_because_script_too_small, \ 1318 V8.CompileScriptMicroSeconds.NoCache.ScriptTooSmall, 1000000, \ 1320 HT(compile_script_no_cache_because_cache_too_cold, \ 1321 V8.CompileScriptMicroSeconds.NoCache.CacheTooCold, 1000000, MICROSECOND) \ 1322 HT(compile_script_on_background, \ 1323 V8.CompileScriptMicroSeconds.BackgroundThread, 1000000, MICROSECOND) \ 1324 HT(compile_function_on_background, \ 1325 V8.CompileFunctionMicroSeconds.BackgroundThread, 1000000, MICROSECOND) \ 1326 HT(gc_parallel_task_latency, V8.GC.ParallelTaskLatencyMicroSeconds, 1000000, \ 1329 #define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \ 1330 AHT(compile_lazy, V8.CompileLazyMicroSeconds) 1332 #define HISTOGRAM_PERCENTAGE_LIST(HP) \ 1334 HP(external_fragmentation_total, V8.MemoryExternalFragmentationTotal) \ 1335 HP(external_fragmentation_old_space, V8.MemoryExternalFragmentationOldSpace) \ 1336 HP(external_fragmentation_code_space, \ 1337 V8.MemoryExternalFragmentationCodeSpace) \ 1338 HP(external_fragmentation_map_space, V8.MemoryExternalFragmentationMapSpace) \ 1339 HP(external_fragmentation_lo_space, V8.MemoryExternalFragmentationLoSpace) 1342 #define HISTOGRAM_LEGACY_MEMORY_LIST(HM) \ 1343 HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted) \ 1344 HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed) \ 1345 HM(heap_sample_map_space_committed, V8.MemoryHeapSampleMapSpaceCommitted) \ 1346 HM(heap_sample_code_space_committed, V8.MemoryHeapSampleCodeSpaceCommitted) \ 1347 HM(heap_sample_maximum_committed, V8.MemoryHeapSampleMaximumCommitted) 1354 #define STATS_COUNTER_LIST_1(SC) \ 1356 SC(global_handles, V8.GlobalHandles) \ 1358 SC(memory_allocated, V8.OsMemoryAllocated) \ 1359 SC(maps_normalized, V8.MapsNormalized) \ 1360 SC(maps_created, V8.MapsCreated) \ 1361 SC(elements_transitions, V8.ObjectElementsTransitions) \ 1362 SC(props_to_dictionary, V8.ObjectPropertiesToDictionary) \ 1363 SC(elements_to_dictionary, V8.ObjectElementsToDictionary) \ 1364 SC(alive_after_last_gc, V8.AliveAfterLastGC) \ 1365 SC(objs_since_last_young, V8.ObjsSinceLastYoung) \ 1366 SC(objs_since_last_full, V8.ObjsSinceLastFull) \ 1367 SC(string_table_capacity, V8.StringTableCapacity) \ 1368 SC(number_of_symbols, V8.NumberOfSymbols) \ 1369 SC(inlined_copied_elements, V8.InlinedCopiedElements) \ 1370 SC(compilation_cache_hits, V8.CompilationCacheHits) \ 1371 SC(compilation_cache_misses, V8.CompilationCacheMisses) \ 1373 SC(total_eval_size, V8.TotalEvalSize) \ 1375 SC(total_load_size, V8.TotalLoadSize) \ 1377 SC(total_parse_size, V8.TotalParseSize) \ 1379 SC(total_preparse_skipped, V8.TotalPreparseSkipped) \ 1381 SC(total_compile_size, V8.TotalCompileSize) \ 1383 SC(total_full_codegen_source_size, V8.TotalFullCodegenSourceSize) \ 1385 SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \ 1387 SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot) \ 1389 SC(pc_to_code, V8.PcToCode) \ 1390 SC(pc_to_code_cached, V8.PcToCodeCached) \ 1392 SC(store_buffer_overflows, V8.StoreBufferOverflows) 1394 #define STATS_COUNTER_LIST_2(SC) \ 1396 SC(code_stubs, V8.CodeStubs) \ 1398 SC(total_stubs_code_size, V8.TotalStubsCodeSize) \ 1400 SC(total_compiled_code_size, V8.TotalCompiledCodeSize) \ 1401 SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest) \ 1402 SC(gc_compactor_caused_by_promoted_data, V8.GCCompactorCausedByPromotedData) \ 1403 SC(gc_compactor_caused_by_oldspace_exhaustion, \ 1404 V8.GCCompactorCausedByOldspaceExhaustion) \ 1405 SC(gc_last_resort_from_js, V8.GCLastResortFromJS) \ 1406 SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles) \ 1407 SC(ic_keyed_load_generic_smi, V8.ICKeyedLoadGenericSmi) \ 1408 SC(ic_keyed_load_generic_symbol, V8.ICKeyedLoadGenericSymbol) \ 1409 SC(ic_keyed_load_generic_slow, V8.ICKeyedLoadGenericSlow) \ 1410 SC(ic_named_load_global_stub, V8.ICNamedLoadGlobalStub) \ 1411 SC(ic_store_normal_miss, V8.ICStoreNormalMiss) \ 1412 SC(ic_store_normal_hit, V8.ICStoreNormalHit) \ 1413 SC(ic_binary_op_miss, V8.ICBinaryOpMiss) \ 1414 SC(ic_compare_miss, V8.ICCompareMiss) \ 1415 SC(ic_call_miss, V8.ICCallMiss) \ 1416 SC(ic_keyed_call_miss, V8.ICKeyedCallMiss) \ 1417 SC(ic_store_miss, V8.ICStoreMiss) \ 1418 SC(ic_keyed_store_miss, V8.ICKeyedStoreMiss) \ 1419 SC(cow_arrays_converted, V8.COWArraysConverted) \ 1420 SC(constructed_objects, V8.ConstructedObjects) \ 1421 SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime) \ 1422 SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes) \ 1423 SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses) \ 1424 SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates) \ 1425 SC(enum_cache_hits, V8.EnumCacheHits) \ 1426 SC(enum_cache_misses, V8.EnumCacheMisses) \ 1427 SC(fast_new_closure_total, V8.FastNewClosureTotal) \ 1428 SC(string_add_runtime, V8.StringAddRuntime) \ 1429 SC(string_add_native, V8.StringAddNative) \ 1430 SC(string_add_runtime_ext_to_one_byte, V8.StringAddRuntimeExtToOneByte) \ 1431 SC(sub_string_runtime, V8.SubStringRuntime) \ 1432 SC(sub_string_native, V8.SubStringNative) \ 1433 SC(regexp_entry_runtime, V8.RegExpEntryRuntime) \ 1434 SC(regexp_entry_native, V8.RegExpEntryNative) \ 1435 SC(math_exp_runtime, V8.MathExpRuntime) \ 1436 SC(math_log_runtime, V8.MathLogRuntime) \ 1437 SC(math_pow_runtime, V8.MathPowRuntime) \ 1438 SC(stack_interrupts, V8.StackInterrupts) \ 1439 SC(runtime_profiler_ticks, V8.RuntimeProfilerTicks) \ 1440 SC(runtime_calls, V8.RuntimeCalls) \ 1441 SC(bounds_checks_eliminated, V8.BoundsChecksEliminated) \ 1442 SC(bounds_checks_hoisted, V8.BoundsChecksHoisted) \ 1443 SC(soft_deopts_requested, V8.SoftDeoptsRequested) \ 1444 SC(soft_deopts_inserted, V8.SoftDeoptsInserted) \ 1445 SC(soft_deopts_executed, V8.SoftDeoptsExecuted) \ 1447 SC(write_barriers_dynamic, V8.WriteBarriersDynamic) \ 1448 SC(write_barriers_static, V8.WriteBarriersStatic) \ 1449 SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \ 1450 SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \ 1451 SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \ 1452 SC(old_space_bytes_available, V8.MemoryOldSpaceBytesAvailable) \ 1453 SC(old_space_bytes_committed, V8.MemoryOldSpaceBytesCommitted) \ 1454 SC(old_space_bytes_used, V8.MemoryOldSpaceBytesUsed) \ 1455 SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable) \ 1456 SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted) \ 1457 SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed) \ 1458 SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable) \ 1459 SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted) \ 1460 SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \ 1461 SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \ 1462 SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \ 1463 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \ 1465 SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \ 1467 SC(total_baseline_compile_count, V8.TotalBaselineCompileCount) 1469 #define STATS_COUNTER_TS_LIST(SC) \ 1470 SC(wasm_generated_code_size, V8.WasmGeneratedCodeBytes) \ 1471 SC(wasm_reloc_size, V8.WasmRelocBytes) \ 1472 SC(wasm_lazily_compiled_functions, V8.WasmLazilyCompiledFunctions) \ 1473 SC(liftoff_compiled_functions, V8.LiftoffCompiledFunctions) \ 1474 SC(liftoff_unsupported_functions, V8.LiftoffUnsupportedFunctions) 1477 class Counters :
public std::enable_shared_from_this<Counters> {
1484 void ResetCounterFunction(CounterLookupCallback f);
1489 void ResetCreateHistogramFunction(CreateHistogramCallback f);
1494 void SetAddHistogramSampleFunction(AddHistogramSampleCallback f) {
1495 stats_table_.SetAddHistogramSampleFunction(f);
1498 #define HR(name, caption, min, max, num_buckets) \ 1499 Histogram* name() { return &name##_; } 1500 HISTOGRAM_RANGE_LIST(HR)
1503 #define HT(name, caption, max, res) \ 1504 HistogramTimer* name() { return &name##_; } 1505 HISTOGRAM_TIMER_LIST(HT)
1508 #define HT(name, caption, max, res) \ 1509 TimedHistogram* name() { return &name##_; } 1510 TIMED_HISTOGRAM_LIST(HT)
1513 #define AHT(name, caption) \ 1514 AggregatableHistogramTimer* name() { return &name##_; } 1515 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
1518 #define HP(name, caption) \ 1519 Histogram* name() { return &name##_; } 1520 HISTOGRAM_PERCENTAGE_LIST(HP)
1523 #define HM(name, caption) \ 1524 Histogram* name() { return &name##_; } 1525 HISTOGRAM_LEGACY_MEMORY_LIST(HM)
1528 #define SC(name, caption) \ 1529 StatsCounter* name() { return &name##_; } 1530 STATS_COUNTER_LIST_1(SC)
1531 STATS_COUNTER_LIST_2(SC)
1534 #define SC(name, caption) \ 1535 StatsCounterThreadSafe* name() { return &name##_; } 1536 STATS_COUNTER_TS_LIST(SC)
1541 #define RATE_ID(name, caption, max, res) k_##name, 1542 HISTOGRAM_TIMER_LIST(RATE_ID)
1543 TIMED_HISTOGRAM_LIST(RATE_ID)
1545 #define AGGREGATABLE_ID(name, caption) k_##name, 1546 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AGGREGATABLE_ID)
1547 #undef AGGREGATABLE_ID 1548 #define PERCENTAGE_ID(name, caption) k_##name, 1549 HISTOGRAM_PERCENTAGE_LIST(PERCENTAGE_ID)
1550 #undef PERCENTAGE_ID 1551 #define MEMORY_ID(name, caption) k_##name, 1552 HISTOGRAM_LEGACY_MEMORY_LIST(MEMORY_ID)
1554 #define COUNTER_ID(name, caption) k_##name, 1555 STATS_COUNTER_LIST_1(COUNTER_ID)
1556 STATS_COUNTER_LIST_2(COUNTER_ID)
1557 STATS_COUNTER_TS_LIST(COUNTER_ID)
1559 #define COUNTER_ID(name) kCountOf##name, kSizeOf##name, 1560 INSTANCE_TYPE_LIST(COUNTER_ID)
1562 #define COUNTER_ID(name) kCountOfCODE_TYPE_##name, \ 1563 kSizeOfCODE_TYPE_##name, 1564 CODE_KIND_LIST(COUNTER_ID)
1566 #define COUNTER_ID(name) kCountOfFIXED_ARRAY__##name, \ 1567 kSizeOfFIXED_ARRAY__##name, 1568 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
1577 return &worker_thread_runtime_call_stats_;
1589 int* FindLocation(
const char* name) {
1590 return stats_table_.FindLocation(name);
1593 void* CreateHistogram(
const char* name,
int min,
int max,
size_t buckets) {
1594 return stats_table_.CreateHistogram(name, min, max, buckets);
1597 void AddHistogramSample(
void* histogram,
int sample) {
1598 stats_table_.AddHistogramSample(histogram, sample);
1601 Isolate* isolate() {
return isolate_; }
1603 #define HR(name, caption, min, max, num_buckets) Histogram name##_; 1604 HISTOGRAM_RANGE_LIST(HR)
1607 #define HT(name, caption, max, res) HistogramTimer name##_; 1608 HISTOGRAM_TIMER_LIST(HT)
1611 #define HT(name, caption, max, res) TimedHistogram name##_; 1612 TIMED_HISTOGRAM_LIST(HT)
1615 #define AHT(name, caption) \ 1616 AggregatableHistogramTimer name##_; 1617 AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT)
1620 #define HP(name, caption) \ 1622 HISTOGRAM_PERCENTAGE_LIST(HP)
1625 #define HM(name, caption) \ 1627 HISTOGRAM_LEGACY_MEMORY_LIST(HM)
1630 #define SC(name, caption) \ 1631 StatsCounter name##_; 1632 STATS_COUNTER_LIST_1(SC)
1633 STATS_COUNTER_LIST_2(SC)
1636 #define SC(name, caption) StatsCounterThreadSafe name##_; 1637 STATS_COUNTER_TS_LIST(SC)
1641 StatsCounter size_of_##name##_; \ 1642 StatsCounter count_of_##name##_; 1643 INSTANCE_TYPE_LIST(SC)
1647 StatsCounter size_of_CODE_TYPE_##name##_; \ 1648 StatsCounter count_of_CODE_TYPE_##name##_; 1653 StatsCounter size_of_FIXED_ARRAY_##name##_; \ 1654 StatsCounter count_of_FIXED_ARRAY_##name##_; 1655 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
1661 DISALLOW_IMPLICIT_CONSTRUCTORS(
Counters);
1664 void HistogramTimer::Start() {
1665 TimedHistogram::Start(&timer_, counters()->isolate());
1668 void HistogramTimer::Stop() {
1669 TimedHistogram::Stop(&timer_, counters()->isolate());
1672 RuntimeCallTimerScope::RuntimeCallTimerScope(Isolate* isolate,
1673 RuntimeCallCounterId counter_id) {
1674 if (V8_LIKELY(!FLAG_runtime_stats))
return;
1675 stats_ = isolate->counters()->runtime_call_stats();
1676 stats_->Enter(&timer_, counter_id);
1682 #endif // V8_COUNTERS_H_