Add APIs into wasm_c_api.h to summary wasm function execution duration (#3639)

- `wasm_instance_sum_wasm_exec_time()` ->
  `wasm_runtime_sum_wasm_exec_time()`
- `wasm_instance_get_wasm_func_exec_time()` ->
  `wasm_runtime_get_wasm_func_exec_time()`
This commit is contained in:
liang.he
2024-07-23 16:34:47 +08:00
committed by GitHub
parent b086d5820a
commit 5e7d3ed59b
2 changed files with 26 additions and 0 deletions

View File

@ -5379,3 +5379,24 @@ wasm_extern_new_empty(wasm_store_t *store, wasm_externkind_t extern_kind)
LOG_ERROR("Don't support linking table and memory for now");
return NULL;
}
double
wasm_instance_sum_wasm_exec_time(const wasm_instance_t *instance)
{
#if WASM_ENABLE_PERF_PROFILING != 0
return wasm_runtime_sum_wasm_exec_time(instance->inst_comm_rt);
#else
return -1.0;
#endif
}
double
wasm_instance_get_wasm_func_exec_time(const wasm_instance_t *instance,
const char *name)
{
#if WASM_ENABLE_PERF_PROFILING != 0
return wasm_runtime_get_wasm_func_exec_time(instance->inst_comm_rt, name);
#else
return -1.0;
#endif
}