You can make accurate measurements by reading the time counter ( tsc ) of the CPU, which increases by one with each clock.
Unfortunately, reading is done using some assembler instructions in the code. Depending on the underlying architecture, the cost of reading varies from ~ 11 (AMD) to ~ 33 (Intel) tsc . With a 1 GHz processor, you can actually get nano-second accuracy.
, :
- , cpu, AMD cool'n Intel SpeedStep.
- , .
- , SHED_RR SHED_FIFO. / , .
- mlockall().
- ++, Linux, Linux, tsc i386, x86_64 ia64.