7 #include <sys/sysctl.h>
10 static double cpufrequency
= 0;
12 static void init(void)
14 cpufrequency
= osfreq();
17 long long cpucycles_monotoniccpuinfo(void)
21 if (!cpufrequency
) init();
22 clock_gettime(CLOCK_MONOTONIC
,&t
);
24 result
*= 0.000000001;
25 result
+= (double) t
.tv_sec
;
26 result
*= cpufrequency
;
30 long long cpucycles_monotoniccpuinfo_persecond(void)
32 if (!cpufrequency
) init();