[wasm] Add uma stat for wasm lazy throughput

This CL adds an uma stat to track the throughput
of lazy compilation for wasm functions in KB/s.

BUG=chromium:770618
R=kschimpf@chromium.org,bradnelson@chromium.org,isherman@chromium.org

Change-Id: Iad06cfb1f185f7e2ab6b0198282c03c3d8f29e2e
Reviewed-on: https://chromium-review.googlesource.com/706276
Commit-Queue: Aseem Garg <aseemgarg@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Brad Nelson <bradnelson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48475}
This commit is contained in:
Aseem Garg 2017-10-11 12:52:28 -07:00 committed by Commit Bot
parent 1117da834c
commit 9fdb8c8255
4 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View File

@ -99,3 +99,4 @@ turbo*.cfg
turbo*.dot
turbo*.json
v8.ignition_dispatches_table.json
/Default/

View File

@ -271,11 +271,13 @@ CompilationJob::Status AsmJsCompilationJob::ExecuteJobImpl() {
compilation_info()->literal()->start_position();
compilation_info()->isolate()->counters()->asm_module_size_bytes()->AddSample(
module_size);
int64_t translate_time_micro = translate_timer.Elapsed().InMicroseconds();
int64_t translation_time_micro = translate_timer.Elapsed().InMicroseconds();
// translation_throughput is not exact (assumes MB == 1000000). But that is ok
// since the metric is stored in buckets that lose some precision anyways.
int translation_throughput =
translate_time_micro != 0
translation_time_micro != 0
? static_cast<int>(static_cast<int64_t>(module_size) /
translate_time_micro)
translation_time_micro)
: 0;
compilation_info()
->isolate()

View File

@ -1032,7 +1032,9 @@ class RuntimeCallTimerScope {
V8.WasmCompileFunctionPeakMemoryBytes, 1, GB, 51) \
HR(asm_module_size_bytes, V8.AsmModuleSizeBytes, 1, GB, 51) \
HR(asm_wasm_translation_throughput, V8.AsmWasmTranslationThroughput, 1, 100, \
20)
20) \
HR(wasm_lazy_compilation_throughput, V8.WasmLazyCompilationThroughput, 1, \
10000, 50)
#define HISTOGRAM_TIMER_LIST(HT) \
/* Garbage collection timers. */ \

View File

@ -729,6 +729,8 @@ compiler::ModuleEnv CreateModuleEnvFromCompiledModule(
void LazyCompilationOrchestrator::CompileFunction(
Isolate* isolate, Handle<WasmInstanceObject> instance, int func_index) {
base::ElapsedTimer compilation_timer;
compilation_timer.Start();
Handle<WasmCompiledModule> compiled_module(instance->compiled_module(),
isolate);
if (Code::cast(compiled_module->code_table()->get(func_index))->kind() ==
@ -789,10 +791,16 @@ void LazyCompilationOrchestrator::CompileFunction(
code_specialization.ApplyToWasmCode(*code, SKIP_ICACHE_FLUSH);
Assembler::FlushICache(isolate, code->instruction_start(),
code->instruction_size());
int64_t func_size =
static_cast<int64_t>(func->code.end_offset() - func->code.offset());
int64_t compilation_time = compilation_timer.Elapsed().InMicroseconds();
auto counters = isolate->counters();
counters->wasm_lazily_compiled_functions()->Increment();
counters->wasm_generated_code_size()->Increment(code->body_size());
counters->wasm_reloc_size()->Increment(code->relocation_info()->length());
counters->wasm_lazy_compilation_throughput()->AddSample(
compilation_time != 0 ? static_cast<int>(func_size / compilation_time)
: 0);
}
int AdvanceSourcePositionTableIterator(SourcePositionTableIterator& iterator,