11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_LOGGING_COUNTERS_DEFINITIONS_H_
61cb0ef41Sopenharmony_ci#define V8_LOGGING_COUNTERS_DEFINITIONS_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "include/v8-internal.h"
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cinamespace v8 {
111cb0ef41Sopenharmony_cinamespace internal {
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci#define HISTOGRAM_RANGE_LIST(HR)                                               \
141cb0ef41Sopenharmony_ci  /* Generic range histograms: HR(name, caption, min, max, num_buckets) */     \
151cb0ef41Sopenharmony_ci  HR(background_marking, V8.GCBackgroundMarking, 0, 10000, 101)                \
161cb0ef41Sopenharmony_ci  HR(background_sweeping, V8.GCBackgroundSweeping, 0, 10000, 101)              \
171cb0ef41Sopenharmony_ci  HR(code_cache_reject_reason, V8.CodeCacheRejectReason, 1, 6, 6)              \
181cb0ef41Sopenharmony_ci  HR(errors_thrown_per_context, V8.ErrorsThrownPerContext, 0, 200, 20)         \
191cb0ef41Sopenharmony_ci  HR(debug_feature_usage, V8.DebugFeatureUsage, 1, 7, 7)                       \
201cb0ef41Sopenharmony_ci  HR(incremental_marking_reason, V8.GCIncrementalMarkingReason, 0,             \
211cb0ef41Sopenharmony_ci     kGarbageCollectionReasonMaxValue, kGarbageCollectionReasonMaxValue + 1)   \
221cb0ef41Sopenharmony_ci  HR(incremental_marking_sum, V8.GCIncrementalMarkingSum, 0, 10000, 101)       \
231cb0ef41Sopenharmony_ci  HR(mark_compact_reason, V8.GCMarkCompactReason, 0,                           \
241cb0ef41Sopenharmony_ci     kGarbageCollectionReasonMaxValue, kGarbageCollectionReasonMaxValue + 1)   \
251cb0ef41Sopenharmony_ci  HR(gc_finalize_clear, V8.GCFinalizeMC.Clear, 0, 10000, 101)                  \
261cb0ef41Sopenharmony_ci  HR(gc_finalize_epilogue, V8.GCFinalizeMC.Epilogue, 0, 10000, 101)            \
271cb0ef41Sopenharmony_ci  HR(gc_finalize_evacuate, V8.GCFinalizeMC.Evacuate, 0, 10000, 101)            \
281cb0ef41Sopenharmony_ci  HR(gc_finalize_finish, V8.GCFinalizeMC.Finish, 0, 10000, 101)                \
291cb0ef41Sopenharmony_ci  HR(gc_finalize_mark, V8.GCFinalizeMC.Mark, 0, 10000, 101)                    \
301cb0ef41Sopenharmony_ci  HR(gc_finalize_prologue, V8.GCFinalizeMC.Prologue, 0, 10000, 101)            \
311cb0ef41Sopenharmony_ci  HR(gc_finalize_sweep, V8.GCFinalizeMC.Sweep, 0, 10000, 101)                  \
321cb0ef41Sopenharmony_ci  HR(gc_scavenger_scavenge_main, V8.GCScavenger.ScavengeMain, 0, 10000, 101)   \
331cb0ef41Sopenharmony_ci  HR(gc_scavenger_scavenge_roots, V8.GCScavenger.ScavengeRoots, 0, 10000, 101) \
341cb0ef41Sopenharmony_ci  HR(gc_marking_sum, V8.GCMarkingSum, 0, 10000, 101)                           \
351cb0ef41Sopenharmony_ci  /* Range and bucket matches BlinkGC.MainThreadMarkingThroughput. */          \
361cb0ef41Sopenharmony_ci  HR(gc_main_thread_marking_throughput, V8.GCMainThreadMarkingThroughput, 0,   \
371cb0ef41Sopenharmony_ci     100000, 50)                                                               \
381cb0ef41Sopenharmony_ci  HR(young_generation_handling, V8.GCYoungGenerationHandling, 0, 2, 3)         \
391cb0ef41Sopenharmony_ci  /* Asm/Wasm. */                                                              \
401cb0ef41Sopenharmony_ci  HR(wasm_functions_per_asm_module, V8.WasmFunctionsPerModule.asm, 1, 1000000, \
411cb0ef41Sopenharmony_ci     51)                                                                       \
421cb0ef41Sopenharmony_ci  HR(wasm_functions_per_wasm_module, V8.WasmFunctionsPerModule.wasm, 1,        \
431cb0ef41Sopenharmony_ci     1000000, 51)                                                              \
441cb0ef41Sopenharmony_ci  HR(array_buffer_big_allocations, V8.ArrayBufferLargeAllocations, 0, 4096,    \
451cb0ef41Sopenharmony_ci     13)                                                                       \
461cb0ef41Sopenharmony_ci  HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096,   \
471cb0ef41Sopenharmony_ci     13)                                                                       \
481cb0ef41Sopenharmony_ci  HR(shared_array_allocations, V8.SharedArrayAllocationSizes, 0, 4096, 13)     \
491cb0ef41Sopenharmony_ci  HR(wasm_asm_huge_function_size_bytes, V8.WasmHugeFunctionSizeBytes.asm,      \
501cb0ef41Sopenharmony_ci     100 * KB, GB, 51)                                                         \
511cb0ef41Sopenharmony_ci  HR(wasm_wasm_huge_function_size_bytes, V8.WasmHugeFunctionSizeBytes.wasm,    \
521cb0ef41Sopenharmony_ci     100 * KB, GB, 51)                                                         \
531cb0ef41Sopenharmony_ci  HR(wasm_asm_module_size_bytes, V8.WasmModuleSizeBytes.asm, 1, GB, 51)        \
541cb0ef41Sopenharmony_ci  HR(wasm_wasm_module_size_bytes, V8.WasmModuleSizeBytes.wasm, 1, GB, 51)      \
551cb0ef41Sopenharmony_ci  HR(wasm_asm_min_mem_pages_count, V8.WasmMinMemPagesCount.asm, 1, 2 << 16,    \
561cb0ef41Sopenharmony_ci     51)                                                                       \
571cb0ef41Sopenharmony_ci  HR(wasm_wasm_min_mem_pages_count, V8.WasmMinMemPagesCount.wasm, 1, 2 << 16,  \
581cb0ef41Sopenharmony_ci     51)                                                                       \
591cb0ef41Sopenharmony_ci  HR(wasm_wasm_max_mem_pages_count, V8.WasmMaxMemPagesCount.wasm, 1, 2 << 16,  \
601cb0ef41Sopenharmony_ci     51)                                                                       \
611cb0ef41Sopenharmony_ci  HR(wasm_compile_function_peak_memory_bytes,                                  \
621cb0ef41Sopenharmony_ci     V8.WasmCompileFunctionPeakMemoryBytes, 1, GB, 51)                         \
631cb0ef41Sopenharmony_ci  HR(wasm_compile_huge_function_peak_memory_bytes,                             \
641cb0ef41Sopenharmony_ci     V8.WasmCompileHugeFunctionPeakMemoryBytes, 1, GB, 51)                     \
651cb0ef41Sopenharmony_ci  HR(asm_module_size_bytes, V8.AsmModuleSizeBytes, 1, GB, 51)                  \
661cb0ef41Sopenharmony_ci  HR(compile_script_cache_behaviour, V8.CompileScript.CacheBehaviour, 0, 20,   \
671cb0ef41Sopenharmony_ci     21)                                                                       \
681cb0ef41Sopenharmony_ci  HR(wasm_memory_allocation_result, V8.WasmMemoryAllocationResult, 0, 3, 4)    \
691cb0ef41Sopenharmony_ci  /* committed code size per module, collected on GC */                        \
701cb0ef41Sopenharmony_ci  HR(wasm_module_code_size_mb, V8.WasmModuleCodeSizeMiB, 0, 1024, 64)          \
711cb0ef41Sopenharmony_ci  /* code size per module after baseline compilation */                        \
721cb0ef41Sopenharmony_ci  HR(wasm_module_code_size_mb_after_baseline,                                  \
731cb0ef41Sopenharmony_ci     V8.WasmModuleCodeSizeBaselineMiB, 0, 1024, 64)                            \
741cb0ef41Sopenharmony_ci  /* code size per module after top-tier compilation */                        \
751cb0ef41Sopenharmony_ci  HR(wasm_module_code_size_mb_after_top_tier, V8.WasmModuleCodeSizeTopTierMiB, \
761cb0ef41Sopenharmony_ci     0, 1024, 64)                                                              \
771cb0ef41Sopenharmony_ci  /* percent of freed code size per module, collected on GC */                 \
781cb0ef41Sopenharmony_ci  HR(wasm_module_freed_code_size_percent, V8.WasmModuleCodeSizePercentFreed,   \
791cb0ef41Sopenharmony_ci     0, 100, 32)                                                               \
801cb0ef41Sopenharmony_ci  /* number of code GCs triggered per native module, collected on code GC */   \
811cb0ef41Sopenharmony_ci  HR(wasm_module_num_triggered_code_gcs,                                       \
821cb0ef41Sopenharmony_ci     V8.WasmModuleNumberOfCodeGCsTriggered, 1, 128, 20)                        \
831cb0ef41Sopenharmony_ci  /* number of code spaces reserved per wasm module */                         \
841cb0ef41Sopenharmony_ci  HR(wasm_module_num_code_spaces, V8.WasmModuleNumberOfCodeSpaces, 1, 128, 20) \
851cb0ef41Sopenharmony_ci  /* number of live modules per isolate */                                     \
861cb0ef41Sopenharmony_ci  HR(wasm_modules_per_isolate, V8.WasmModulesPerIsolate, 1, 1024, 30)          \
871cb0ef41Sopenharmony_ci  /* number of live modules per engine (i.e. whole process) */                 \
881cb0ef41Sopenharmony_ci  HR(wasm_modules_per_engine, V8.WasmModulesPerEngine, 1, 1024, 30)            \
891cb0ef41Sopenharmony_ci  /* bailout reason if Liftoff failed, or {kSuccess} (per function) */         \
901cb0ef41Sopenharmony_ci  HR(liftoff_bailout_reasons, V8.LiftoffBailoutReasons, 0, 20, 21)             \
911cb0ef41Sopenharmony_ci  /* support for PKEYs/PKU by testing result of pkey_alloc() */                \
921cb0ef41Sopenharmony_ci  HR(wasm_memory_protection_keys_support, V8.WasmMemoryProtectionKeysSupport,  \
931cb0ef41Sopenharmony_ci     0, 1, 2)                                                                  \
941cb0ef41Sopenharmony_ci  /* number of thrown exceptions per isolate */                                \
951cb0ef41Sopenharmony_ci  HR(wasm_throw_count, V8.WasmThrowCount, 0, 100000, 30)                       \
961cb0ef41Sopenharmony_ci  /* number of rethrown exceptions per isolate */                              \
971cb0ef41Sopenharmony_ci  HR(wasm_rethrow_count, V8.WasmReThrowCount, 0, 100000, 30)                   \
981cb0ef41Sopenharmony_ci  /* number of caught exceptions per isolate */                                \
991cb0ef41Sopenharmony_ci  HR(wasm_catch_count, V8.WasmCatchCount, 0, 100000, 30)                       \
1001cb0ef41Sopenharmony_ci  /* Ticks observed in a single Turbofan compilation, in 1K */                 \
1011cb0ef41Sopenharmony_ci  HR(turbofan_ticks, V8.TurboFan1KTicks, 0, 100000, 200)                       \
1021cb0ef41Sopenharmony_ci  /* Backtracks observed in a single regexp interpreter execution */           \
1031cb0ef41Sopenharmony_ci  /* The maximum of 100M backtracks takes roughly 2 seconds on my machine. */  \
1041cb0ef41Sopenharmony_ci  HR(regexp_backtracks, V8.RegExpBacktracks, 1, 100000000, 50)                 \
1051cb0ef41Sopenharmony_ci  /* See the CagedMemoryAllocationOutcome enum in backing-store.cc */          \
1061cb0ef41Sopenharmony_ci  HR(caged_memory_allocation_outcome, V8.CagedMemoryAllocationOutcome, 0, 2,   \
1071cb0ef41Sopenharmony_ci     3)                                                                        \
1081cb0ef41Sopenharmony_ci  /* number of times a cache event is triggered for a wasm module */           \
1091cb0ef41Sopenharmony_ci  HR(wasm_cache_count, V8.WasmCacheCount, 0, 100, 101)                         \
1101cb0ef41Sopenharmony_ci  SANDBOXED_HISTOGRAM_LIST(HR)
1111cb0ef41Sopenharmony_ci
1121cb0ef41Sopenharmony_ci#ifdef V8_SANDBOX_IS_AVAILABLE
1131cb0ef41Sopenharmony_ci#define SANDBOXED_HISTOGRAM_LIST(HR)                                          \
1141cb0ef41Sopenharmony_ci  /* Number of in-use external pointers in the external pointer table */      \
1151cb0ef41Sopenharmony_ci  /* Counted after sweeping the table at the end of mark-compact GC */        \
1161cb0ef41Sopenharmony_ci  HR(sandboxed_external_pointers_count, V8.SandboxedExternalPointersCount, 0, \
1171cb0ef41Sopenharmony_ci     kMaxSandboxedExternalPointers, 101)
1181cb0ef41Sopenharmony_ci#else
1191cb0ef41Sopenharmony_ci#define SANDBOXED_HISTOGRAM_LIST(HR)
1201cb0ef41Sopenharmony_ci#endif  // V8_SANDBOX_IS_AVAILABLE
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ci#define NESTED_TIMED_HISTOGRAM_LIST(HT)                                       \
1231cb0ef41Sopenharmony_ci  /* Timer histograms, not thread safe: HT(name, caption, max, unit) */       \
1241cb0ef41Sopenharmony_ci  /* Garbage collection timers. */                                            \
1251cb0ef41Sopenharmony_ci  HT(gc_idle_notification, V8.GCIdleNotification, 10000, MILLISECOND)         \
1261cb0ef41Sopenharmony_ci  HT(gc_incremental_marking, V8.GCIncrementalMarking, 10000, MILLISECOND)     \
1271cb0ef41Sopenharmony_ci  HT(gc_incremental_marking_start, V8.GCIncrementalMarkingStart, 10000,       \
1281cb0ef41Sopenharmony_ci     MILLISECOND)                                                             \
1291cb0ef41Sopenharmony_ci  HT(gc_incremental_marking_finalize, V8.GCIncrementalMarkingFinalize, 10000, \
1301cb0ef41Sopenharmony_ci     MILLISECOND)                                                             \
1311cb0ef41Sopenharmony_ci  HT(gc_low_memory_notification, V8.GCLowMemoryNotification, 10000,           \
1321cb0ef41Sopenharmony_ci     MILLISECOND)                                                             \
1331cb0ef41Sopenharmony_ci  /* Compilation times. */                                                    \
1341cb0ef41Sopenharmony_ci  HT(collect_source_positions, V8.CollectSourcePositions, 1000000,            \
1351cb0ef41Sopenharmony_ci     MICROSECOND)                                                             \
1361cb0ef41Sopenharmony_ci  HT(compile, V8.CompileMicroSeconds, 1000000, MICROSECOND)                   \
1371cb0ef41Sopenharmony_ci  HT(compile_eval, V8.CompileEvalMicroSeconds, 1000000, MICROSECOND)          \
1381cb0ef41Sopenharmony_ci  /* Serialization as part of compilation (code caching) */                   \
1391cb0ef41Sopenharmony_ci  HT(compile_serialize, V8.CompileSerializeMicroSeconds, 100000, MICROSECOND) \
1401cb0ef41Sopenharmony_ci  HT(compile_deserialize, V8.CompileDeserializeMicroSeconds, 1000000,         \
1411cb0ef41Sopenharmony_ci     MICROSECOND)                                                             \
1421cb0ef41Sopenharmony_ci  /* Total compilation time incl. caching/parsing */                          \
1431cb0ef41Sopenharmony_ci  HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND)      \
1441cb0ef41Sopenharmony_ci  /* Time for lazily compiling Wasm functions. */                             \
1451cb0ef41Sopenharmony_ci  HT(wasm_lazy_compile_time, V8.WasmLazyCompileTimeMicroSeconds, 100000000,   \
1461cb0ef41Sopenharmony_ci     MICROSECOND)                                                             \
1471cb0ef41Sopenharmony_ci  HT(wasm_compile_after_deserialize,                                          \
1481cb0ef41Sopenharmony_ci     V8.WasmCompileAfterDeserializeMilliSeconds, 1000000, MILLISECOND)
1491cb0ef41Sopenharmony_ci
1501cb0ef41Sopenharmony_ci#define NESTED_TIMED_HISTOGRAM_LIST_SLOW(HT)                               \
1511cb0ef41Sopenharmony_ci  /* Total V8 time (including JS and runtime calls, exluding callbacks) */ \
1521cb0ef41Sopenharmony_ci  HT(execute, V8.ExecuteMicroSeconds, 1000000, MICROSECOND)
1531cb0ef41Sopenharmony_ci
1541cb0ef41Sopenharmony_ci#define TIMED_HISTOGRAM_LIST(HT)                                               \
1551cb0ef41Sopenharmony_ci  /* Timer histograms, thread safe: HT(name, caption, max, unit) */            \
1561cb0ef41Sopenharmony_ci  /* Garbage collection timers. */                                             \
1571cb0ef41Sopenharmony_ci  HT(gc_compactor, V8.GCCompactor, 10000, MILLISECOND)                         \
1581cb0ef41Sopenharmony_ci  HT(gc_compactor_background, V8.GCCompactorBackground, 10000, MILLISECOND)    \
1591cb0ef41Sopenharmony_ci  HT(gc_compactor_foreground, V8.GCCompactorForeground, 10000, MILLISECOND)    \
1601cb0ef41Sopenharmony_ci  HT(gc_finalize, V8.GCFinalizeMC, 10000, MILLISECOND)                         \
1611cb0ef41Sopenharmony_ci  HT(gc_finalize_background, V8.GCFinalizeMCBackground, 10000, MILLISECOND)    \
1621cb0ef41Sopenharmony_ci  HT(gc_finalize_foreground, V8.GCFinalizeMCForeground, 10000, MILLISECOND)    \
1631cb0ef41Sopenharmony_ci  HT(gc_finalize_measure_memory, V8.GCFinalizeMCMeasureMemory, 10000,          \
1641cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
1651cb0ef41Sopenharmony_ci  HT(gc_finalize_reduce_memory, V8.GCFinalizeMCReduceMemory, 10000,            \
1661cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
1671cb0ef41Sopenharmony_ci  HT(gc_finalize_reduce_memory_background,                                     \
1681cb0ef41Sopenharmony_ci     V8.GCFinalizeMCReduceMemoryBackground, 10000, MILLISECOND)                \
1691cb0ef41Sopenharmony_ci  HT(gc_finalize_reduce_memory_foreground,                                     \
1701cb0ef41Sopenharmony_ci     V8.GCFinalizeMCReduceMemoryForeground, 10000, MILLISECOND)                \
1711cb0ef41Sopenharmony_ci  HT(measure_memory_delay_ms, V8.MeasureMemoryDelayMilliseconds, 100000,       \
1721cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
1731cb0ef41Sopenharmony_ci  HT(gc_time_to_global_safepoint, V8.GC.TimeToGlobalSafepoint, 10000000,       \
1741cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
1751cb0ef41Sopenharmony_ci  HT(gc_time_to_safepoint, V8.GC.TimeToSafepoint, 10000000, MICROSECOND)       \
1761cb0ef41Sopenharmony_ci  HT(gc_time_to_collection_on_background, V8.GC.TimeToCollectionOnBackground,  \
1771cb0ef41Sopenharmony_ci     10000000, MICROSECOND)                                                    \
1781cb0ef41Sopenharmony_ci  /* TurboFan timers. */                                                       \
1791cb0ef41Sopenharmony_ci  HT(turbofan_optimize_prepare, V8.TurboFanOptimizePrepare, 1000000,           \
1801cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
1811cb0ef41Sopenharmony_ci  HT(turbofan_optimize_execute, V8.TurboFanOptimizeExecute, 1000000,           \
1821cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
1831cb0ef41Sopenharmony_ci  HT(turbofan_optimize_finalize, V8.TurboFanOptimizeFinalize, 1000000,         \
1841cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
1851cb0ef41Sopenharmony_ci  HT(turbofan_optimize_total_foreground, V8.TurboFanOptimizeTotalForeground,   \
1861cb0ef41Sopenharmony_ci     10000000, MICROSECOND)                                                    \
1871cb0ef41Sopenharmony_ci  HT(turbofan_optimize_total_background, V8.TurboFanOptimizeTotalBackground,   \
1881cb0ef41Sopenharmony_ci     10000000, MICROSECOND)                                                    \
1891cb0ef41Sopenharmony_ci  HT(turbofan_optimize_total_time, V8.TurboFanOptimizeTotalTime, 10000000,     \
1901cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
1911cb0ef41Sopenharmony_ci  HT(turbofan_optimize_non_concurrent_total_time,                              \
1921cb0ef41Sopenharmony_ci     V8.TurboFanOptimizeNonConcurrentTotalTime, 10000000, MICROSECOND)         \
1931cb0ef41Sopenharmony_ci  HT(turbofan_optimize_concurrent_total_time,                                  \
1941cb0ef41Sopenharmony_ci     V8.TurboFanOptimizeConcurrentTotalTime, 10000000, MICROSECOND)            \
1951cb0ef41Sopenharmony_ci  HT(turbofan_osr_prepare, V8.TurboFanOptimizeForOnStackReplacementPrepare,    \
1961cb0ef41Sopenharmony_ci     1000000, MICROSECOND)                                                     \
1971cb0ef41Sopenharmony_ci  HT(turbofan_osr_execute, V8.TurboFanOptimizeForOnStackReplacementExecute,    \
1981cb0ef41Sopenharmony_ci     1000000, MICROSECOND)                                                     \
1991cb0ef41Sopenharmony_ci  HT(turbofan_osr_finalize, V8.TurboFanOptimizeForOnStackReplacementFinalize,  \
2001cb0ef41Sopenharmony_ci     1000000, MICROSECOND)                                                     \
2011cb0ef41Sopenharmony_ci  HT(turbofan_osr_total_time,                                                  \
2021cb0ef41Sopenharmony_ci     V8.TurboFanOptimizeForOnStackReplacementTotalTime, 10000000, MICROSECOND) \
2031cb0ef41Sopenharmony_ci  /* Wasm timers. */                                                           \
2041cb0ef41Sopenharmony_ci  HT(wasm_compile_asm_module_time, V8.WasmCompileModuleMicroSeconds.asm,       \
2051cb0ef41Sopenharmony_ci     10000000, MICROSECOND)                                                    \
2061cb0ef41Sopenharmony_ci  HT(wasm_compile_wasm_module_time, V8.WasmCompileModuleMicroSeconds.wasm,     \
2071cb0ef41Sopenharmony_ci     10000000, MICROSECOND)                                                    \
2081cb0ef41Sopenharmony_ci  HT(wasm_async_compile_wasm_module_time,                                      \
2091cb0ef41Sopenharmony_ci     V8.WasmCompileModuleAsyncMicroSeconds, 100000000, MICROSECOND)            \
2101cb0ef41Sopenharmony_ci  HT(wasm_streaming_compile_wasm_module_time,                                  \
2111cb0ef41Sopenharmony_ci     V8.WasmCompileModuleStreamingMicroSeconds, 100000000, MICROSECOND)        \
2121cb0ef41Sopenharmony_ci  HT(wasm_streaming_finish_wasm_module_time,                                   \
2131cb0ef41Sopenharmony_ci     V8.WasmFinishModuleStreamingMicroSeconds, 100000000, MICROSECOND)         \
2141cb0ef41Sopenharmony_ci  HT(wasm_deserialization_time, V8.WasmDeserializationTimeMilliSeconds, 10000, \
2151cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
2161cb0ef41Sopenharmony_ci  HT(wasm_tier_up_module_time, V8.WasmTierUpModuleMicroSeconds, 100000000,     \
2171cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
2181cb0ef41Sopenharmony_ci  HT(wasm_compile_asm_function_time, V8.WasmCompileFunctionMicroSeconds.asm,   \
2191cb0ef41Sopenharmony_ci     1000000, MICROSECOND)                                                     \
2201cb0ef41Sopenharmony_ci  HT(wasm_compile_wasm_function_time, V8.WasmCompileFunctionMicroSeconds.wasm, \
2211cb0ef41Sopenharmony_ci     1000000, MICROSECOND)                                                     \
2221cb0ef41Sopenharmony_ci  HT(wasm_compile_huge_function_time, V8.WasmCompileHugeFunctionMilliSeconds,  \
2231cb0ef41Sopenharmony_ci     100000, MILLISECOND)                                                      \
2241cb0ef41Sopenharmony_ci  HT(wasm_instantiate_wasm_module_time,                                        \
2251cb0ef41Sopenharmony_ci     V8.WasmInstantiateModuleMicroSeconds.wasm, 10000000, MICROSECOND)         \
2261cb0ef41Sopenharmony_ci  HT(wasm_instantiate_asm_module_time,                                         \
2271cb0ef41Sopenharmony_ci     V8.WasmInstantiateModuleMicroSeconds.asm, 10000000, MICROSECOND)          \
2281cb0ef41Sopenharmony_ci  HT(wasm_time_between_throws, V8.WasmTimeBetweenThrowsMilliseconds, 1000,     \
2291cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
2301cb0ef41Sopenharmony_ci  HT(wasm_time_between_rethrows, V8.WasmTimeBetweenRethrowsMilliseconds, 1000, \
2311cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
2321cb0ef41Sopenharmony_ci  HT(wasm_time_between_catch, V8.WasmTimeBetweenCatchMilliseconds, 1000,       \
2331cb0ef41Sopenharmony_ci     MILLISECOND)                                                              \
2341cb0ef41Sopenharmony_ci  /* Total compilation time incl. caching/parsing for various cache states. */ \
2351cb0ef41Sopenharmony_ci  HT(compile_script_with_produce_cache,                                        \
2361cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.ProduceCache, 1000000, MICROSECOND)          \
2371cb0ef41Sopenharmony_ci  HT(compile_script_with_isolate_cache_hit,                                    \
2381cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.IsolateCacheHit, 1000000, MICROSECOND)       \
2391cb0ef41Sopenharmony_ci  HT(compile_script_with_consume_cache,                                        \
2401cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.ConsumeCache, 1000000, MICROSECOND)          \
2411cb0ef41Sopenharmony_ci  HT(compile_script_consume_failed,                                            \
2421cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.ConsumeCache.Failed, 1000000, MICROSECOND)   \
2431cb0ef41Sopenharmony_ci  HT(compile_script_no_cache_other,                                            \
2441cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.NoCache.Other, 1000000, MICROSECOND)         \
2451cb0ef41Sopenharmony_ci  HT(compile_script_no_cache_because_inline_script,                            \
2461cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.NoCache.InlineScript, 1000000, MICROSECOND)  \
2471cb0ef41Sopenharmony_ci  HT(compile_script_no_cache_because_script_too_small,                         \
2481cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.NoCache.ScriptTooSmall, 1000000,             \
2491cb0ef41Sopenharmony_ci     MICROSECOND)                                                              \
2501cb0ef41Sopenharmony_ci  HT(compile_script_no_cache_because_cache_too_cold,                           \
2511cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.NoCache.CacheTooCold, 1000000, MICROSECOND)  \
2521cb0ef41Sopenharmony_ci  HT(compile_script_streaming_finalization,                                    \
2531cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.StreamingFinalization, 1000000, MICROSECOND) \
2541cb0ef41Sopenharmony_ci  HT(compile_script_on_background,                                             \
2551cb0ef41Sopenharmony_ci     V8.CompileScriptMicroSeconds.BackgroundThread, 1000000, MICROSECOND)      \
2561cb0ef41Sopenharmony_ci  HT(compile_function_on_background,                                           \
2571cb0ef41Sopenharmony_ci     V8.CompileFunctionMicroSeconds.BackgroundThread, 1000000, MICROSECOND)
2581cb0ef41Sopenharmony_ci
2591cb0ef41Sopenharmony_ci#define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \
2601cb0ef41Sopenharmony_ci  AHT(compile_lazy, V8.CompileLazyMicroSeconds)
2611cb0ef41Sopenharmony_ci
2621cb0ef41Sopenharmony_ci#define HISTOGRAM_PERCENTAGE_LIST(HP)                                          \
2631cb0ef41Sopenharmony_ci  /* Heap fragmentation. */                                                    \
2641cb0ef41Sopenharmony_ci  HP(external_fragmentation_total, V8.MemoryExternalFragmentationTotal)        \
2651cb0ef41Sopenharmony_ci  HP(external_fragmentation_old_space, V8.MemoryExternalFragmentationOldSpace) \
2661cb0ef41Sopenharmony_ci  HP(external_fragmentation_code_space,                                        \
2671cb0ef41Sopenharmony_ci     V8.MemoryExternalFragmentationCodeSpace)                                  \
2681cb0ef41Sopenharmony_ci  HP(external_fragmentation_map_space, V8.MemoryExternalFragmentationMapSpace) \
2691cb0ef41Sopenharmony_ci  HP(external_fragmentation_lo_space, V8.MemoryExternalFragmentationLoSpace)
2701cb0ef41Sopenharmony_ci
2711cb0ef41Sopenharmony_ci// Note: These use Histogram with options (min=1000, max=500000, buckets=50).
2721cb0ef41Sopenharmony_ci#define HISTOGRAM_LEGACY_MEMORY_LIST(HM)                                      \
2731cb0ef41Sopenharmony_ci  HM(heap_sample_total_committed, V8.MemoryHeapSampleTotalCommitted)          \
2741cb0ef41Sopenharmony_ci  HM(heap_sample_total_used, V8.MemoryHeapSampleTotalUsed)                    \
2751cb0ef41Sopenharmony_ci  HM(heap_sample_map_space_committed, V8.MemoryHeapSampleMapSpaceCommitted)   \
2761cb0ef41Sopenharmony_ci  HM(heap_sample_code_space_committed, V8.MemoryHeapSampleCodeSpaceCommitted) \
2771cb0ef41Sopenharmony_ci  HM(heap_sample_maximum_committed, V8.MemoryHeapSampleMaximumCommitted)
2781cb0ef41Sopenharmony_ci
2791cb0ef41Sopenharmony_ci// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
2801cb0ef41Sopenharmony_ci// Intellisense to crash.  It was broken into two macros (each of length 40
2811cb0ef41Sopenharmony_ci// lines) rather than one macro (of length about 80 lines) to work around
2821cb0ef41Sopenharmony_ci// this problem.  Please avoid using recursive macros of this length when
2831cb0ef41Sopenharmony_ci// possible.
2841cb0ef41Sopenharmony_ci#define STATS_COUNTER_LIST_1(SC)                                   \
2851cb0ef41Sopenharmony_ci  /* Global Handle Count*/                                         \
2861cb0ef41Sopenharmony_ci  SC(global_handles, V8.GlobalHandles)                             \
2871cb0ef41Sopenharmony_ci  SC(maps_normalized, V8.MapsNormalized)                           \
2881cb0ef41Sopenharmony_ci  SC(maps_created, V8.MapsCreated)                                 \
2891cb0ef41Sopenharmony_ci  SC(elements_transitions, V8.ObjectElementsTransitions)           \
2901cb0ef41Sopenharmony_ci  SC(props_to_dictionary, V8.ObjectPropertiesToDictionary)         \
2911cb0ef41Sopenharmony_ci  SC(elements_to_dictionary, V8.ObjectElementsToDictionary)        \
2921cb0ef41Sopenharmony_ci  SC(alive_after_last_gc, V8.AliveAfterLastGC)                     \
2931cb0ef41Sopenharmony_ci  SC(objs_since_last_young, V8.ObjsSinceLastYoung)                 \
2941cb0ef41Sopenharmony_ci  SC(objs_since_last_full, V8.ObjsSinceLastFull)                   \
2951cb0ef41Sopenharmony_ci  SC(string_table_capacity, V8.StringTableCapacity)                \
2961cb0ef41Sopenharmony_ci  SC(number_of_symbols, V8.NumberOfSymbols)                        \
2971cb0ef41Sopenharmony_ci  SC(inlined_copied_elements, V8.InlinedCopiedElements)            \
2981cb0ef41Sopenharmony_ci  SC(compilation_cache_hits, V8.CompilationCacheHits)              \
2991cb0ef41Sopenharmony_ci  SC(compilation_cache_misses, V8.CompilationCacheMisses)          \
3001cb0ef41Sopenharmony_ci  /* Amount of evaled source code. */                              \
3011cb0ef41Sopenharmony_ci  SC(total_eval_size, V8.TotalEvalSize)                            \
3021cb0ef41Sopenharmony_ci  /* Amount of loaded source code. */                              \
3031cb0ef41Sopenharmony_ci  SC(total_load_size, V8.TotalLoadSize)                            \
3041cb0ef41Sopenharmony_ci  /* Amount of parsed source code. */                              \
3051cb0ef41Sopenharmony_ci  SC(total_parse_size, V8.TotalParseSize)                          \
3061cb0ef41Sopenharmony_ci  /* Amount of source code skipped over using preparsing. */       \
3071cb0ef41Sopenharmony_ci  SC(total_preparse_skipped, V8.TotalPreparseSkipped)              \
3081cb0ef41Sopenharmony_ci  /* Amount of compiled source code. */                            \
3091cb0ef41Sopenharmony_ci  SC(total_compile_size, V8.TotalCompileSize)                      \
3101cb0ef41Sopenharmony_ci  /* Number of contexts created from scratch. */                   \
3111cb0ef41Sopenharmony_ci  SC(contexts_created_from_scratch, V8.ContextsCreatedFromScratch) \
3121cb0ef41Sopenharmony_ci  /* Number of contexts created by context snapshot. */            \
3131cb0ef41Sopenharmony_ci  SC(contexts_created_by_snapshot, V8.ContextsCreatedBySnapshot)   \
3141cb0ef41Sopenharmony_ci  /* Number of code objects found from pc. */                      \
3151cb0ef41Sopenharmony_ci  SC(pc_to_code, V8.PcToCode)                                      \
3161cb0ef41Sopenharmony_ci  SC(pc_to_code_cached, V8.PcToCodeCached)
3171cb0ef41Sopenharmony_ci
3181cb0ef41Sopenharmony_ci#define STATS_COUNTER_LIST_2(SC)                                               \
3191cb0ef41Sopenharmony_ci  /* Amount of (JS) compiled code. */                                          \
3201cb0ef41Sopenharmony_ci  SC(total_compiled_code_size, V8.TotalCompiledCodeSize)                       \
3211cb0ef41Sopenharmony_ci  SC(gc_compactor_caused_by_request, V8.GCCompactorCausedByRequest)            \
3221cb0ef41Sopenharmony_ci  SC(gc_compactor_caused_by_promoted_data, V8.GCCompactorCausedByPromotedData) \
3231cb0ef41Sopenharmony_ci  SC(gc_compactor_caused_by_oldspace_exhaustion,                               \
3241cb0ef41Sopenharmony_ci     V8.GCCompactorCausedByOldspaceExhaustion)                                 \
3251cb0ef41Sopenharmony_ci  SC(gc_last_resort_from_js, V8.GCLastResortFromJS)                            \
3261cb0ef41Sopenharmony_ci  SC(gc_last_resort_from_handles, V8.GCLastResortFromHandles)                  \
3271cb0ef41Sopenharmony_ci  SC(cow_arrays_converted, V8.COWArraysConverted)                              \
3281cb0ef41Sopenharmony_ci  SC(constructed_objects_runtime, V8.ConstructedObjectsRuntime)                \
3291cb0ef41Sopenharmony_ci  SC(megamorphic_stub_cache_updates, V8.MegamorphicStubCacheUpdates)           \
3301cb0ef41Sopenharmony_ci  SC(enum_cache_hits, V8.EnumCacheHits)                                        \
3311cb0ef41Sopenharmony_ci  SC(enum_cache_misses, V8.EnumCacheMisses)                                    \
3321cb0ef41Sopenharmony_ci  SC(string_add_runtime, V8.StringAddRuntime)                                  \
3331cb0ef41Sopenharmony_ci  SC(sub_string_runtime, V8.SubStringRuntime)                                  \
3341cb0ef41Sopenharmony_ci  SC(regexp_entry_runtime, V8.RegExpEntryRuntime)                              \
3351cb0ef41Sopenharmony_ci  SC(stack_interrupts, V8.StackInterrupts)                                     \
3361cb0ef41Sopenharmony_ci  SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable)               \
3371cb0ef41Sopenharmony_ci  SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted)               \
3381cb0ef41Sopenharmony_ci  SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed)                         \
3391cb0ef41Sopenharmony_ci  SC(old_space_bytes_available, V8.MemoryOldSpaceBytesAvailable)               \
3401cb0ef41Sopenharmony_ci  SC(old_space_bytes_committed, V8.MemoryOldSpaceBytesCommitted)               \
3411cb0ef41Sopenharmony_ci  SC(old_space_bytes_used, V8.MemoryOldSpaceBytesUsed)                         \
3421cb0ef41Sopenharmony_ci  SC(code_space_bytes_available, V8.MemoryCodeSpaceBytesAvailable)             \
3431cb0ef41Sopenharmony_ci  SC(code_space_bytes_committed, V8.MemoryCodeSpaceBytesCommitted)             \
3441cb0ef41Sopenharmony_ci  SC(code_space_bytes_used, V8.MemoryCodeSpaceBytesUsed)                       \
3451cb0ef41Sopenharmony_ci  SC(map_space_bytes_available, V8.MemoryMapSpaceBytesAvailable)               \
3461cb0ef41Sopenharmony_ci  SC(map_space_bytes_committed, V8.MemoryMapSpaceBytesCommitted)               \
3471cb0ef41Sopenharmony_ci  SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed)                         \
3481cb0ef41Sopenharmony_ci  SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable)                 \
3491cb0ef41Sopenharmony_ci  SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted)                 \
3501cb0ef41Sopenharmony_ci  SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)                           \
3511cb0ef41Sopenharmony_ci  /* Total code size (including metadata) of baseline code or bytecode. */     \
3521cb0ef41Sopenharmony_ci  SC(total_baseline_code_size, V8.TotalBaselineCodeSize)                       \
3531cb0ef41Sopenharmony_ci  /* Total count of functions compiled using the baseline compiler. */         \
3541cb0ef41Sopenharmony_ci  SC(total_baseline_compile_count, V8.TotalBaselineCompileCount)               \
3551cb0ef41Sopenharmony_ci  SC(wasm_generated_code_size, V8.WasmGeneratedCodeBytes)                      \
3561cb0ef41Sopenharmony_ci  SC(wasm_reloc_size, V8.WasmRelocBytes)                                       \
3571cb0ef41Sopenharmony_ci  SC(wasm_lazily_compiled_functions, V8.WasmLazilyCompiledFunctions)
3581cb0ef41Sopenharmony_ci
3591cb0ef41Sopenharmony_ci// List of counters that can be incremented from generated code. We need them in
3601cb0ef41Sopenharmony_ci// a separate list to be able to relocate them.
3611cb0ef41Sopenharmony_ci#define STATS_COUNTER_NATIVE_CODE_LIST(SC)                         \
3621cb0ef41Sopenharmony_ci  /* Number of write barriers executed at runtime. */              \
3631cb0ef41Sopenharmony_ci  SC(write_barriers, V8.WriteBarriers)                             \
3641cb0ef41Sopenharmony_ci  SC(constructed_objects, V8.ConstructedObjects)                   \
3651cb0ef41Sopenharmony_ci  SC(fast_new_closure_total, V8.FastNewClosureTotal)               \
3661cb0ef41Sopenharmony_ci  SC(regexp_entry_native, V8.RegExpEntryNative)                    \
3671cb0ef41Sopenharmony_ci  SC(string_add_native, V8.StringAddNative)                        \
3681cb0ef41Sopenharmony_ci  SC(sub_string_native, V8.SubStringNative)                        \
3691cb0ef41Sopenharmony_ci  SC(ic_keyed_load_generic_smi, V8.ICKeyedLoadGenericSmi)          \
3701cb0ef41Sopenharmony_ci  SC(ic_keyed_load_generic_symbol, V8.ICKeyedLoadGenericSymbol)    \
3711cb0ef41Sopenharmony_ci  SC(ic_keyed_load_generic_slow, V8.ICKeyedLoadGenericSlow)        \
3721cb0ef41Sopenharmony_ci  SC(megamorphic_stub_cache_probes, V8.MegamorphicStubCacheProbes) \
3731cb0ef41Sopenharmony_ci  SC(megamorphic_stub_cache_misses, V8.MegamorphicStubCacheMisses)
3741cb0ef41Sopenharmony_ci
3751cb0ef41Sopenharmony_ci}  // namespace internal
3761cb0ef41Sopenharmony_ci}  // namespace v8
3771cb0ef41Sopenharmony_ci
3781cb0ef41Sopenharmony_ci#endif  // V8_LOGGING_COUNTERS_DEFINITIONS_H_
379