Profile unit symbol resolution cost
This commit is contained in:
+18
-1
@@ -123,6 +123,8 @@ struct WasmRequestProfile
|
||||
u64 unit_module_total_us = 0;
|
||||
u64 unit_allocate_total_us = 0;
|
||||
u64 unit_import_total_us = 0;
|
||||
u64 unit_symbol_resolve_count = 0;
|
||||
u64 unit_symbol_resolve_total_us = 0;
|
||||
u64 unit_instantiate_total_us = 0;
|
||||
u64 unit_initialize_total_us = 0;
|
||||
u64 hostcall_count = 0;
|
||||
@@ -1357,7 +1359,11 @@ private:
|
||||
}
|
||||
if(mod_name == "env" && is_func_import)
|
||||
{
|
||||
auto resolve_start = std::chrono::steady_clock::now();
|
||||
auto func = resolve_func(name);
|
||||
unit_symbol_resolve_count++;
|
||||
unit_symbol_resolve_total_us += (u64)std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - resolve_start).count();
|
||||
if(!func)
|
||||
return(source_path + ": unresolved import env." + wasm_trace_demangle(name));
|
||||
imports.push_back(*func);
|
||||
@@ -1367,7 +1373,12 @@ private:
|
||||
{
|
||||
wasmtime::GlobalType global_type(wasmtime::ValType::i32(), true);
|
||||
u32 address = 0;
|
||||
if(resolve_data(name, address))
|
||||
auto resolve_start = std::chrono::steady_clock::now();
|
||||
bool resolved = resolve_data(name, address);
|
||||
unit_symbol_resolve_count++;
|
||||
unit_symbol_resolve_total_us += (u64)std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - resolve_start).count();
|
||||
if(resolved)
|
||||
{
|
||||
auto global = wasmtime::Global::create(cx, global_type, wasmtime::Val((int32_t)address));
|
||||
if(!global)
|
||||
@@ -1388,7 +1399,11 @@ private:
|
||||
}
|
||||
if(mod_name == "GOT.func")
|
||||
{
|
||||
auto resolve_start = std::chrono::steady_clock::now();
|
||||
auto func = resolve_func(name);
|
||||
unit_symbol_resolve_count++;
|
||||
unit_symbol_resolve_total_us += (u64)std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - resolve_start).count();
|
||||
if(!func)
|
||||
return(source_path + ": unresolved GOT.func." + wasm_trace_demangle(name));
|
||||
u32 slot = 0;
|
||||
@@ -1915,6 +1930,8 @@ private:
|
||||
response["unit_module_us"] = (f64)self->unit_module_total_us;
|
||||
response["unit_allocate_us"] = (f64)self->unit_allocate_total_us;
|
||||
response["unit_import_us"] = (f64)self->unit_import_total_us;
|
||||
response["unit_symbol_resolve_count"] = (f64)self->unit_symbol_resolve_count;
|
||||
response["unit_symbol_resolve_us"] = (f64)self->unit_symbol_resolve_total_us;
|
||||
response["unit_instantiate_us"] = (f64)self->unit_instantiate_total_us;
|
||||
response["unit_initialize_us"] = (f64)self->unit_initialize_total_us;
|
||||
f64 running_us = response["running_us"].to_f64();
|
||||
|
||||
Reference in New Issue
Block a user