int main() { cycles_t time1, time2; time1 = caa_get_cycles(); loop_sleep(NR_LOOPS); time2 = caa_get_cycles(); printf("CPU clock cycles per loop: %g\n", (time2 - time1) / (double)NR_LOOPS); return 0; }
int main(int argc, char **argv) { unsigned long i; caa_cycles_t time1, time2; caa_cycles_t time_tot = 0; double cpl; for (i = 0; i < TESTS; i++) { time1 = caa_get_cycles(); loop_sleep(LOOPS); time2 = caa_get_cycles(); time_tot += time2 - time1; } cpl = ((double)time_tot) / (double)TESTS / (double)LOOPS; printf("CALIBRATION : %g cycles per loop\n", cpl); printf("time_tot = %llu, LOOPS = %d, TESTS = %d\n", (unsigned long long) time_tot, LOOPS, TESTS); return 0; }