mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-23 00:00:05 +01:00
24 lines
410 B
C
24 lines
410 B
C
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include "get_clock.h"
|
|
|
|
int main()
|
|
{
|
|
int no_cpu_freq_fail = 0;
|
|
double mhz;
|
|
mhz = get_cpu_mhz(no_cpu_freq_fail);
|
|
cycles_t c1, c2;
|
|
|
|
if (!mhz) {
|
|
printf("Unable to calibrate cycles. Exiting.\n");
|
|
return 2;
|
|
}
|
|
|
|
printf("Type CTRL-C to cancel.\n");
|
|
for (;;) {
|
|
c1 = get_cycles();
|
|
sleep(1);
|
|
c2 = get_cycles();
|
|
printf("1 sec = %g usec\n", (c2 - c1) / mhz);
|
|
}
|
|
}
|