Add printingAdd print time for wamrc, fix posix mmap bug time for wamrc, fixed a posix mmap bug. (#206)

Change-Id: Ib6517b8a69cf022a1a6a74efa1f98155aec143bc
This commit is contained in:
Shi Lei
2020-03-20 16:06:40 +08:00
committed by GitHub
parent e07381c4a8
commit b6cae54b54
6 changed files with 61 additions and 1 deletions

View File

@ -52,3 +52,28 @@ bh_log(LogLevel log_level, const char *file, int line, const char *fmt, ...)
os_printf("\n");
}
static uint32 last_time_ms = 0;
static uint32 total_time_ms = 0;
void
bh_print_time(const char *prompt)
{
uint32 curr_time_ms;
if (log_verbose_level < 3)
return;
curr_time_ms = (uint32)bh_get_tick_ms();
if (last_time_ms == 0)
last_time_ms = curr_time_ms;
total_time_ms += curr_time_ms - last_time_ms;
printf("%-48s time of last stage: %u ms, total time: %u ms\n",
prompt, curr_time_ms - last_time_ms, total_time_ms);
last_time_ms = curr_time_ms;
}

View File

@ -47,6 +47,9 @@ bh_log(LogLevel log_level, const char *file, int line, const char *fmt, ...);
#define LOG_WARNING(...) bh_log(LOG_LEVEL_WARNING, NULL, 0, __VA_ARGS__)
#define LOG_VERBOSE(...) bh_log(LOG_LEVEL_VERBOSE, NULL, 0, __VA_ARGS__)
void
bh_print_time(const char *prompt);
#ifdef __cplusplus
}
#endif