// A known amount of work: a loop of exactly four instructions, N times // (argv[1], default ten million). What the counters are checked against, // and the run that tracing overhead is measured on. #include int main(int argc, char **argv) { unsigned long n = argc > 1 ? strtoul(argv[1], 0, 0) : 10000000; __asm__ volatile("1: dec %0\n nop\n nop\n jnz 1b" : "+r"(n) : : "cc"); return 0; }