[wasm] Add trace events for code logging

These trace events can be used for triaging profiling issues.
We already have one event if code logging is triggered via an interrupt.
The new events will be emitted if called via the foreground task, or
just directly (e.g. after deserialization).

R=ecmziegler@chromium.org

Change-Id: I67ad9568f38d9a6eb98abf53ce5542ed56170c60
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2376811
Reviewed-by: Emanuel Ziegler <ecmziegler@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69608}
This commit is contained in:
Clemens Backes 2020-08-28 13:45:34 +02:00 committed by Commit Bot
parent 2c4f2de147
commit 6bc807698a
2 changed files with 7 additions and 2 deletions

View File

@ -847,10 +847,13 @@ void NativeModule::ReserveCodeTableForTesting(uint32_t max_functions) {
void NativeModule::LogWasmCodes(Isolate* isolate) {
if (!WasmCode::ShouldBeLogged(isolate)) return;
TRACE_EVENT1("v8.wasm", "wasm.LogWasmCodes", "num_functions",
module_->num_declared_functions);
// TODO(titzer): we skip the logging of the import wrappers
// here, but they should be included somehow.
int start = module()->num_imported_functions;
int end = start + module()->num_declared_functions;
int start = module_->num_imported_functions;
int end = start + module_->num_declared_functions;
WasmCodeRefScope code_ref_scope;
for (int func_index = start; func_index < end; ++func_index) {
if (WasmCode* code = GetCode(func_index)) code->LogCode(isolate);

View File

@ -1041,6 +1041,8 @@ void WasmEngine::LogOutstandingCodesForIsolate(Isolate* isolate) {
DCHECK_EQ(1, isolates_.count(isolate));
code_to_log.swap(isolates_[isolate]->code_to_log);
}
TRACE_EVENT1("v8.wasm", "wasm.LogCode", "num_code_objects",
code_to_log.size());
if (code_to_log.empty()) return;
for (WasmCode* code : code_to_log) {
code->LogCode(isolate);