I was curious to know what level of precision I could get when using time.sleep(x)
,
like, if it made any sense to try and sleep for say 0.0132
seconds.
It turns out, it does. On a Windows machine with a 1.6GHz processor, I get a sample rate such:
$ python3 time_sampling.py 6
Average step over 1000000 (100.0%) iterations: 2.77e-07
Sample frequency: 3.61 MHz
That is, nearly four million samples.
First argument of the script is a decimal order of magnitude (power of 10, denoting the iterations to perform).