File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -144,9 +144,10 @@ double ProcessCPUUsage() {
144144 DiagnoseAndExit (" clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed" );
145145#elif defined(__wasm__)
146146 // <aztec>
147- // We define a fallback that works with wasi. We return something
148- // obviously wrong - we don't want per-thread timing.
149- return 0 ;
147+ // We define a fallback that works with wasi
148+ struct timeval tv;
149+ gettimeofday (&tv, nullptr );
150+ return static_cast <int64_t >(tv.tv_sec ) * 1000000 + tv.tv_usec ;
150151 // </ aztec>
151152#else
152153 struct rusage ru;
@@ -201,9 +202,10 @@ double ThreadCPUUsage() {
201202 DiagnoseAndExit (" clock_gettime(CLOCK_THREAD_CPUTIME_ID, ...) failed" );
202203#else
203204 // <aztec>
204- // We define a fallback that works with wasi. We return something
205- // obviously wrong - we don't want per-thread timing.
206- return 0 ;
205+ // We define a fallback that works with wasi
206+ struct timeval tv;
207+ gettimeofday (&tv, nullptr );
208+ return static_cast <int64_t >(tv.tv_sec ) * 1000000 + tv.tv_usec ;
207209 // </ aztec>
208210#endif
209211}
You can’t perform that action at this time.
0 commit comments