1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-15 04:06:19 +00:00

Emscripten/wasm does not support getrusage() system call

Updating the MiscStats data can at best provide the time of day and
attribute all elapsed time to total CPU time.

Closes issue #1537
This commit is contained in:
Nick Briggs
2024-02-12 09:30:46 -08:00
parent ce20accae3
commit 9f02ce0590

View File

@@ -118,6 +118,19 @@ void update_miscstats(void) {
MiscStats->diskiotime = 0; /* ?? not available ?? */
MiscStats->diskops = 0;
MiscStats->secondstmp = MiscStats->secondsclock = (time(0) + UNIX_ALTO_TIME_DIFF);
#elif defined(MAIKO_OS_EMSCRIPTEN)
/* Emscripten does not provide getrusage() functionality */
struct timeval timev;
MiscStats->totaltime = gettime(0) - MiscStats->starttime;
MiscStats->swapwaittime = 0;
MiscStats->pagefaults = 0;
MiscStats->swapwrites = 0;
MiscStats->diskiotime = 0;
MiscStats->diskops = 0;
gettimeofday(&timev, NULL);
MiscStats->secondstmp = MiscStats->secondsclock = (timev.tv_sec + UNIX_ALTO_TIME_DIFF);
#else
struct timeval timev;
struct rusage ru;