We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ce3ce0 commit e2f292fCopy full SHA for e2f292f
2 files changed
criterion-measurement/cbits/cycles.c
@@ -68,6 +68,18 @@ criterion_rdtsc (void)
68
return result;
69
}
70
71
+#elif wasm32_HOST_ARCH
72
+
73
+#include <time.h>
74
75
+StgWord64 criterion_rdtsc(void)
76
+{
77
+ struct timespec ts;
78
+ StgWord64 result_stg = 0;
79
+ clock_gettime(CLOCK_REALTIME, &ts);
80
+ result_stg = ts.tv_sec * 1000000000LL + ts.tv_nsec;
81
+ return result_stg;
82
+}
83
#else
84
85
#error Unsupported OS/architecture/compiler!
criterion-measurement/cbits/time-posix.c
@@ -18,7 +18,11 @@ double criterion_getcputime(void)
18
{
19
struct timespec ts;
20
21
+#ifndef __wasi__
22
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
23
+#else
24
25
+#endif
26
27
return ts.tv_sec + ts.tv_nsec * 1e-9;
28
0 commit comments