Skip to content

Commit

Permalink
Make cpu time == time
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad0 committed Jan 24, 2024
1 parent 9b721b1 commit d3d46b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/timers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ double ProcessCPUUsage() {
DiagnoseAndExit("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed");
#elif defined(__wasm__)
// <aztec>
// We define a fallback that works with wasi. We return something
// obviously wrong - we don't want per-thread timing.
return 0;
// We define a fallback that works with wasi
struct timeval tv;
gettimeofday(&tv, nullptr);
return static_cast<int64_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
// </ aztec>
#else
struct rusage ru;
Expand Down

0 comments on commit d3d46b8

Please sign in to comment.