I'm just wondering what the limits for time are. I have a program that always takes exactly 20 ms, so I assume this is the lowest it can measure, but I want to see if there's some sort of documentation of this.
|
feedback
|
|
The shortest time interval it can measure is 1 jiffy, which is the inverse of the frequency specified in the build options for the kernel (CONFIG_HZ). | |||||
feedback
|
|
I agree with Ignacio's response however I believe it misses a critical point. Although a jiffy is theoretically the smallest unit it can measure, sometimes very short durations are inaccurate because the underlying hardware does not measure changes in time that quickly. In my experience, anything less than one millisecond cannot accurately be compared to something else (although that figure could be as high as 5 or 10 milliseconds). If you are trying to benchmark a specific operation or program, consider having it run many hundreds or thousands of times then dividing that total time by the number of iterations to find a more accurate value. | |||
feedback
|
|
Try this:
On my (old and slow) system, subsequent runs of:
finish in as little as:
| |||
feedback
|