unsigned loop_time_overhead() { unsigned ccnt = 0; ccnt = ccnt_read(); for (int i = 0; i < LOOP_TIME_TEST_NUM; i++) { } ccnt = ccnt_read() - ccnt; return ccnt / LOOP_TIME_TEST_NUM; }
unsigned reading_time_overhead() { unsigned ccnt = 0; unsigned total_ccnt = 0; for (int i = 0; i < OVERHEAD_TEST_NUM; i++) { ccnt = ccnt_read(); ccnt = ccnt_read() - ccnt; total_ccnt += ccnt; } return total_ccnt / OVERHEAD_TEST_NUM; }
unsigned get_overhead() { unsigned t; float total = 0; for (int i = 0; i < OVERHEAD_TEST_NUM; i++) { t = ccnt_read(); t = ccnt_read() - t; total += (float)t; // printf("%dth measurement overhead: %u\n",i, t); } printf("Avg measurement overhead: %f\n", (float)total/OVERHEAD_TEST_NUM); return (total/OVERHEAD_TEST_NUM); }
void counter_stop(void) { c2 = ccnt_read(); }
void counter_start(void) { c1 = ccnt_read(); }