mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
perf profiling: Adjust the calculation of execution time (#3089)
This commit is contained in:
parent
9fb5fcc709
commit
99bbad8cdb
|
@ -2845,14 +2845,13 @@ aot_free_frame(WASMExecEnv *exec_env)
|
|||
AOTFrame *prev_frame = cur_frame->prev_frame;
|
||||
|
||||
#if WASM_ENABLE_PERF_PROFILING != 0
|
||||
cur_frame->func_perf_prof_info->total_exec_time +=
|
||||
os_time_thread_cputime_us() - cur_frame->time_started;
|
||||
uint64 elapsed = os_time_thread_cputime_us() - cur_frame->time_started;
|
||||
cur_frame->func_perf_prof_info->total_exec_time += elapsed;
|
||||
cur_frame->func_perf_prof_info->total_exec_cnt++;
|
||||
|
||||
/* parent function */
|
||||
if (prev_frame)
|
||||
prev_frame->func_perf_prof_info->children_exec_time =
|
||||
cur_frame->func_perf_prof_info->total_exec_time;
|
||||
prev_frame->func_perf_prof_info->children_exec_time += elapsed;
|
||||
#endif
|
||||
|
||||
wasm_exec_env_free_wasm_frame(exec_env, cur_frame);
|
||||
|
|
|
@ -867,13 +867,12 @@ FREE_FRAME(WASMExecEnv *exec_env, WASMInterpFrame *frame)
|
|||
#if WASM_ENABLE_PERF_PROFILING != 0
|
||||
if (frame->function) {
|
||||
WASMInterpFrame *prev_frame = frame->prev_frame;
|
||||
frame->function->total_exec_time +=
|
||||
os_time_thread_cputime_us() - frame->time_started;
|
||||
uint64 elapsed = os_time_thread_cputime_us() - frame->time_started;
|
||||
frame->function->total_exec_time += elapsed;
|
||||
frame->function->total_exec_cnt++;
|
||||
|
||||
if (prev_frame && prev_frame->function)
|
||||
prev_frame->function->children_exec_time +=
|
||||
frame->function->total_exec_time;
|
||||
prev_frame->function->children_exec_time += elapsed;
|
||||
}
|
||||
#endif
|
||||
wasm_exec_env_free_wasm_frame(exec_env, frame);
|
||||
|
|
|
@ -901,14 +901,12 @@ FREE_FRAME(WASMExecEnv *exec_env, WASMInterpFrame *frame)
|
|||
#if WASM_ENABLE_PERF_PROFILING != 0
|
||||
if (frame->function) {
|
||||
WASMInterpFrame *prev_frame = frame->prev_frame;
|
||||
|
||||
frame->function->total_exec_time +=
|
||||
os_time_thread_cputime_us() - frame->time_started;
|
||||
uint64 elapsed = os_time_thread_cputime_us() - frame->time_started;
|
||||
frame->function->total_exec_time += elapsed;
|
||||
frame->function->total_exec_cnt++;
|
||||
|
||||
if (prev_frame && prev_frame->function)
|
||||
prev_frame->function->children_exec_time +=
|
||||
frame->function->total_exec_time;
|
||||
prev_frame->function->children_exec_time += elapsed;
|
||||
}
|
||||
#endif
|
||||
wasm_exec_env_free_wasm_frame(exec_env, frame);
|
||||
|
|
|
@ -3455,14 +3455,13 @@ llvm_jit_free_frame(WASMExecEnv *exec_env)
|
|||
|
||||
#if WASM_ENABLE_PERF_PROFILING != 0
|
||||
if (frame->function) {
|
||||
frame->function->total_exec_time +=
|
||||
os_time_thread_cputime_us() - frame->time_started;
|
||||
uint64 elapsed = os_time_thread_cputime_us() - frame->time_started;
|
||||
frame->function->total_exec_time += elapsed;
|
||||
frame->function->total_exec_cnt++;
|
||||
|
||||
/* parent function */
|
||||
if (prev_frame)
|
||||
prev_frame->function->children_exec_time =
|
||||
frame->function->total_exec_time;
|
||||
prev_frame->function->children_exec_time += elapsed;
|
||||
}
|
||||
#endif
|
||||
wasm_exec_env_free_wasm_frame(exec_env, frame);
|
||||
|
|
Loading…
Reference in New Issue
Block a user