Implement wasi clock_time/clock_res get (#2637)
Add os_clock_res_get and os_clock_time_get in platform_api_extension.h, and implement them in posix like platforms and windows platform.
This commit is contained in:
@ -36,6 +36,26 @@ extern "C" {
|
||||
* 2. To build the app-mgr and app-framework, you must implement it
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get a resolution of the clock
|
||||
*
|
||||
* @param clock_id clock identifier
|
||||
* @param resolution output variable to store the clock resolution
|
||||
* @return BHT_OK if success; otherwise, BHT_ERROR
|
||||
*/
|
||||
int
|
||||
os_clock_res_get(bh_clock_id_t clock_id, uint64 *resolution);
|
||||
|
||||
/**
|
||||
* Get a current time of the clock
|
||||
*
|
||||
* @param clock_id clock identifier
|
||||
* @param time output variable to store the clock time
|
||||
* @return BHT_OK if success; otherwise, BHT_ERROR
|
||||
*/
|
||||
int
|
||||
os_clock_time_get(bh_clock_id_t clock_id, uint64 precision, uint64 *time);
|
||||
|
||||
/**
|
||||
* Creates a thread
|
||||
*
|
||||
|
||||
@ -37,6 +37,13 @@ extern "C" {
|
||||
#define BH_TIME_T_MAX LONG_MAX
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
BH_CLOCK_ID_REALTIME,
|
||||
BH_CLOCK_ID_MONOTONIC,
|
||||
BH_CLOCK_ID_PROCESS_CPUTIME_ID,
|
||||
BH_CLOCK_ID_THREAD_CPUTIME_ID
|
||||
} bh_clock_id_t;
|
||||
|
||||
#if defined(_MSC_BUILD)
|
||||
#if defined(COMPILING_WASM_RUNTIME_API)
|
||||
__declspec(dllexport) void *BH_MALLOC(unsigned int size);
|
||||
|
||||
Reference in New Issue
Block a user