Enhancements on wasm function execution time statistic (#2985)

Enhance the statistic of wasm function execution time, or the performance
profiling feature:
- Add os_time_thread_cputime_us() to get the cputime of a thread,
  and use it to calculate the execution time of a wasm function
- Support the statistic of the children execution time of a function,
  and dump it in wasm_runtime_dump_perf_profiling
- Expose two APIs:
  wasm_runtime_sum_wasm_exec_time
  wasm_runtime_get_wasm_func_exec_time

And rename os_time_get_boot_microsecond to os_time_get_boot_us.
This commit is contained in:
liang.he
2024-01-17 09:51:54 +08:00
committed by GitHub
parent 25ccc9f2d5
commit 5c8b8a17a6
24 changed files with 336 additions and 86 deletions

View File

@ -286,6 +286,8 @@ typedef struct AOTFuncPerfProfInfo {
uint64 total_exec_time;
/* total execution count */
uint32 total_exec_cnt;
/* children execution time */
uint64 children_exec_time;
} AOTFuncPerfProfInfo;
/* AOT auxiliary call stack */
@ -613,6 +615,13 @@ aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len);
void
aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
double
aot_summarize_wasm_execute_time(const AOTModuleInstance *inst);
double
aot_get_wasm_func_exec_time(const AOTModuleInstance *inst,
const char *func_name);
const uint8 *
aot_get_custom_section(const AOTModule *module, const char *name, uint32 *len);