Author: wmb Date: 2009-11-19 01:12:30 +0100 (Thu, 19 Nov 2009) New Revision: 1488
Modified: cpu/x86/acpitimer.fth cpu/x86/pc/olpc/config.fth cpu/x86/pc/olpc/via/config.fth cpu/x86/tsc.fth Log: OLPC trac 9698 - Switched back to using the timestamp counter for timing operations, because the ACPI timer rolls over too frequently for operations like fs-update. We will just have to live with the variability due to throttling.
Modified: cpu/x86/acpitimer.fth =================================================================== --- cpu/x86/acpitimer.fth 2009-11-18 23:39:03 UTC (rev 1487) +++ cpu/x86/acpitimer.fth 2009-11-19 00:12:30 UTC (rev 1488) @@ -23,10 +23,13 @@ d# 100,000 um/mod nip to us-factor ( ) ;
-[ifdef] use-acpi-timing +[ifdef] use-acpi-delays : us ( us -- ) acpi-us ; ' acpi-ms to ms +[then]
+[ifdef] use-acpi-timing + \ Timing tools variable timestamp1 : t( ( -- ) acpi-timer@ timestamp1 ! ;
Modified: cpu/x86/pc/olpc/config.fth =================================================================== --- cpu/x86/pc/olpc/config.fth 2009-11-18 23:39:03 UTC (rev 1487) +++ cpu/x86/pc/olpc/config.fth 2009-11-19 00:12:30 UTC (rev 1488) @@ -17,8 +17,10 @@ create jffs2-support create use-elf
-\ create use-timestamp-counter \ Use CPU's timestamp counter for timing ... - \ ... this is worthwhile if your CPU has one. +\ The disadvantage of the timestamp counter is that it changes speed with +\ CPU throttling. The advantage is that it is 64 bits, so no rollover. +create use-timestamp-counter \ Use CPU's timestamp counter for "ms" +create use-tsc-timing \ Use timestamp counter for t( .. )t
create resident-packages \ create use-watch-all
Modified: cpu/x86/pc/olpc/via/config.fth =================================================================== --- cpu/x86/pc/olpc/via/config.fth 2009-11-18 23:39:03 UTC (rev 1487) +++ cpu/x86/pc/olpc/via/config.fth 2009-11-19 00:12:30 UTC (rev 1488) @@ -26,10 +26,17 @@ create linux-support create use-elf
-\ create use-timestamp-counter \ Use CPU's timestamp counter for timing ... - \ ... this is worthwhile if your CPU has one. -create use-acpi-timing +\ The disadvantage of the timestamp counter is that it changes speed with +\ CPU throttling. The advantage is that it is 64 bits, so no rollover. +create use-timestamp-counter \ Use CPU's timestamp counter for "ms" +create use-tsc-timing \ Use timestamp counter for t( .. )t
+\ The advantage of the ACPI counter is that its speed is independent of +\ CPU throttling. The disadvantage is that it is 32 bits, so it rolls +\ over every 20 minutes or so, unless you extend it with an SMI handler. +\ create use-acpi-timing +\ create use-acpi-delays + create resident-packages \ create use-watch-all create no-floppy-node
Modified: cpu/x86/tsc.fth =================================================================== --- cpu/x86/tsc.fth 2009-11-18 23:39:03 UTC (rev 1487) +++ cpu/x86/tsc.fth 2009-11-19 00:12:30 UTC (rev 1488) @@ -35,8 +35,10 @@ : 1ms ( -- ) ms-factor spins ; : us ( #microseconds -- ) us-factor * spins ;
+[ifdef] use-timestamp-counter : (ms) ( #ms -- ) 0 ?do 1ms loop ; ' (ms) to ms +[then]
[ifdef] use-tsc-timing \ These are precise but inaccurate, as the TSC varies with clock throttling \ Timing tools
openfirmware@openfirmware.info