> The way Linux does that is to use the time-stamping counter of the
> processor (the rdtsc instructions), which (originally) counts one unit
> per CPU clock. I believe current processors use slightly different
> countings (e.g. through the APIC), but still: you get a resolution
> within the clock frequency of the CPU quartz.

Linux has an internal clocksource API supporting different hardwares:

PIT (Intel 8253 chipset): configurable frequency between 8.2 Hz and 1.2 MHz
PMTMR (power management timer): ACPI clock with a frequency of 3.5 MHz
TSC (Time Stamp Counter): frequency of your CPU
HPET (High Precision Event Timer): frequency of at least 10 MHz (14.3
MHz on my computer)

Linux has an algorithm to choose the best clock depend on its
performance and accurary.

Most clocks have a frequency higher than 1 MHz and so a resolution
smaller than 1 us, even if the clock is not really accurate.

I suppose that you can plug specialized hardward like an atomic
clocks, or a GPS receiver, for a better accurary.

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to