Commit 61927f30 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Add histogram for number of live modules

So far we operated under the assumption that only a small number of
modules is being created (and live) at a time, typically just one.
Recently we saw webpages that create multiple modules at the same time.
These counters should give us more insight into the typical number of
modules in the wild.

R=ecmziegler@chromium.org
CC=jwd@chromium.org

Bug: chromium:1076767
Change-Id: I81f657ee76ea155f0df2a5828e6b0f686a7ce7d0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2182376Reviewed-by: 's avatarEmanuel Ziegler <ecmziegler@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67589}
parent 046e693c
...@@ -79,6 +79,10 @@ namespace internal { ...@@ -79,6 +79,10 @@ namespace internal {
V8.WasmModuleNumberOfCodeGCsTriggered, 1, 128, 20) \ V8.WasmModuleNumberOfCodeGCsTriggered, 1, 128, 20) \
/* number of code spaces reserved per wasm module */ \ /* number of code spaces reserved per wasm module */ \
HR(wasm_module_num_code_spaces, V8.WasmModuleNumberOfCodeSpaces, 1, 128, 20) \ HR(wasm_module_num_code_spaces, V8.WasmModuleNumberOfCodeSpaces, 1, 128, 20) \
/* number of live modules per isolate */ \
HR(wasm_modules_per_isolate, V8.WasmModulesPerIsolate, 1, 1024, 30) \
/* number of live modules per engine (i.e. whole process) */ \
HR(wasm_modules_per_engine, V8.WasmModulesPerEngine, 1, 1024, 30) \
/* bailout reason if Liftoff failed, or {kSuccess} (per function) */ \ /* bailout reason if Liftoff failed, or {kSuccess} (per function) */ \
HR(liftoff_bailout_reasons, V8.LiftoffBailoutReasons, 0, 20, 21) \ HR(liftoff_bailout_reasons, V8.LiftoffBailoutReasons, 0, 20, 21) \
/* Ticks observed in a single Turbofan compilation, in 1K */ \ /* Ticks observed in a single Turbofan compilation, in 1K */ \
......
...@@ -984,10 +984,15 @@ std::shared_ptr<NativeModule> WasmEngine::NewNativeModule( ...@@ -984,10 +984,15 @@ std::shared_ptr<NativeModule> WasmEngine::NewNativeModule(
native_module.get(), std::make_unique<NativeModuleInfo>())); native_module.get(), std::make_unique<NativeModuleInfo>()));
DCHECK(pair.second); // inserted new entry. DCHECK(pair.second); // inserted new entry.
pair.first->second.get()->isolates.insert(isolate); pair.first->second.get()->isolates.insert(isolate);
isolates_[isolate]->native_modules.insert(native_module.get()); auto& modules_per_isolate = isolates_[isolate]->native_modules;
modules_per_isolate.insert(native_module.get());
if (isolates_[isolate]->keep_tiered_down) { if (isolates_[isolate]->keep_tiered_down) {
native_module->SetTieredDown(); native_module->SetTieredDown();
} }
isolate->counters()->wasm_modules_per_isolate()->AddSample(
static_cast<int>(modules_per_isolate.size()));
isolate->counters()->wasm_modules_per_engine()->AddSample(
static_cast<int>(native_modules_.size()));
return native_module; return 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