[wasm] Add lazy compilation metrics for 60s and 120s

In https://crrev.com/c/3811502 metrics for lazy compilation were
introduced that get recorded 5 seconds and 20 seconds after
instantiation. With this CL we record these metrics also 60 seconds and
120 seconds after instantiation.

R=clemensb@chromium.org

Bug: v8:12852
Change-Id: If95a3453f6a8510b567d291158d4119b022c1c9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3810248
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82265}
This commit is contained in:
Andreas Haas 2022-08-08 13:21:30 +02:00 committed by V8 LUCI CQ
parent 588f3b3792
commit d9dcca6d2f
2 changed files with 40 additions and 1 deletions

View File

@ -112,6 +112,10 @@ namespace internal {
HR(wasm_num_lazy_compilations_5sec, V8.WasmNumLazyCompilations5Sec, 0, \
200000, 50) \
HR(wasm_num_lazy_compilations_20sec, V8.WasmNumLazyCompilations20Sec, 0, \
200000, 50) \
HR(wasm_num_lazy_compilations_60sec, V8.WasmNumLazyCompilations60Sec, 0, \
200000, 50) \
HR(wasm_num_lazy_compilations_120sec, V8.WasmNumLazyCompilations120Sec, 0, \
200000, 50)
#define NESTED_TIMED_HISTOGRAM_LIST(HT) \
@ -254,10 +258,18 @@ namespace internal {
V8.WasmMaxLazyCompilationTime5SecMilliSeconds, 5000, MILLISECOND) \
HT(wasm_max_lazy_compilation_time_20sec, \
V8.WasmMaxLazyCompilationTime20SecMilliSeconds, 5000, MILLISECOND) \
HT(wasm_max_lazy_compilation_time_60sec, \
V8.WasmMaxLazyCompilationTime60SecMilliSeconds, 5000, MILLISECOND) \
HT(wasm_max_lazy_compilation_time_120sec, \
V8.WasmMaxLazyCompilationTime120SecMilliSeconds, 5000, MILLISECOND) \
HT(wasm_sum_lazy_compilation_time_5sec, \
V8.WasmSumLazyCompilationTime5SecMilliSeconds, 20000, MILLISECOND) \
HT(wasm_sum_lazy_compilation_time_20sec, \
V8.WasmSumLazyCompilationTime20SecMilliSeconds, 20000, MILLISECOND)
V8.WasmSumLazyCompilationTime20SecMilliSeconds, 20000, MILLISECOND) \
HT(wasm_sum_lazy_compilation_time_60sec, \
V8.WasmSumLazyCompilationTime60SecMilliSeconds, 20000, MILLISECOND) \
HT(wasm_sum_lazy_compilation_time_120sec, \
V8.WasmSumLazyCompilationTime120SecMilliSeconds, 20000, MILLISECOND)
#define AGGREGATABLE_HISTOGRAM_TIMER_LIST(AHT) \
AHT(compile_lazy, V8.CompileLazyMicroSeconds)

View File

@ -414,6 +414,23 @@ class ReportLazyCompilationTimesTask : public v8::Task {
static_cast<int>(native_module->max_lazy_compilation_time_in_ms()));
return;
}
if (delay_in_seconds_ == 60) {
counters->wasm_num_lazy_compilations_60sec()->AddSample(num_compilations);
counters->wasm_sum_lazy_compilation_time_60sec()->AddSample(
static_cast<int>(native_module->sum_lazy_compilation_time_in_ms()));
counters->wasm_max_lazy_compilation_time_60sec()->AddSample(
static_cast<int>(native_module->max_lazy_compilation_time_in_ms()));
return;
}
if (delay_in_seconds_ == 120) {
counters->wasm_num_lazy_compilations_120sec()->AddSample(
num_compilations);
counters->wasm_sum_lazy_compilation_time_120sec()->AddSample(
static_cast<int>(native_module->sum_lazy_compilation_time_in_ms()));
counters->wasm_max_lazy_compilation_time_120sec()->AddSample(
static_cast<int>(native_module->max_lazy_compilation_time_in_ms()));
return;
}
UNREACHABLE();
}
@ -448,6 +465,16 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
isolate->async_counters(), module_object->shared_native_module(),
20),
20.0);
V8::GetCurrentPlatform()->CallDelayedOnWorkerThread(
std::make_unique<ReportLazyCompilationTimesTask>(
isolate->async_counters(), module_object->shared_native_module(),
60),
60.0);
V8::GetCurrentPlatform()->CallDelayedOnWorkerThread(
std::make_unique<ReportLazyCompilationTimesTask>(
isolate->async_counters(), module_object->shared_native_module(),
120),
120.0);
}
if (builder.ExecuteStartFunction()) {
return instance;