Commit 0db35a93 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Add timed histogram for lazy compile time

We currently only measure the compilation time of individual functions,
but that does not include other things that happen for lazy compilation,
like switching memory permissions or publishing the code.

This CL adds a dedicated counter to measure the complete lazy
compilation time.

R=jkummerow@chromium.org
CC=dlehmann@google.com

Bug: v8:11940
Change-Id: I9a87882d2adc7bea6c5258954a642da18b8337ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2997106Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75498}
parent 64d483a0
......@@ -123,7 +123,10 @@ namespace internal {
/* Total compilation time incl. caching/parsing */ \
HT(compile_script, V8.CompileScriptMicroSeconds, 1000000, MICROSECOND) \
/* Total JavaScript execution time (including callbacks and runtime calls */ \
HT(execute, V8.Execute, 1000000, MICROSECOND)
HT(execute, V8.Execute, 1000000, MICROSECOND) \
/* Time for lazily compiling Wasm functions. */ \
HT(wasm_lazy_compile_time, V8.WasmLazyCompileTimeMicroSeconds, 100000000, \
MICROSECOND)
#define TIMED_HISTOGRAM_LIST(HT) \
/* Timer histograms, thread safe: HT(name, caption, max, unit) */ \
......
......@@ -1114,6 +1114,14 @@ bool CompileLazy(Isolate* isolate, Handle<WasmModuleObject> module_object,
auto enabled_features = native_module->enabled_features();
Counters* counters = isolate->counters();
// Put the timer scope around everything, including the {CodeSpaceWriteScope}
// and its destruction, to measure complete overhead (apart from the runtime
// function itself, which has constant overhead).
base::Optional<TimedHistogramScope> lazy_compile_time_scope;
if (base::TimeTicks::IsHighResolution()) {
lazy_compile_time_scope.emplace(counters->wasm_lazy_compile_time());
}
DCHECK(!native_module->lazy_compile_frozen());
CodeSpaceWriteScope code_space_write_scope(native_module);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment