Re: Rob: Verne Tice's High Resolution Timing routines
- Posted by Vincent <darkvincentdude at yahoo.com> Dec 18, 2005
- 552 views
Robert Craig wrote: > I haven't looked at his stuff in any detail, > but maybe there's a way of testing at start-up whether Verne's > routines can be used. If not, I would fall back to using the > normal time(). You could do it by detecting the processor ID with ASM. Based on that, you would probably have to determind which Pentium or K6 class (and newer) of processors & chipsets allow for dynamic clock frequency change (Intel's SpeedStep, AMD's PowerNow! technologies). We know Intel's Centrino, mobile Pentium 3-4, and Pentium M CPUs all support SpeedStep; AMD's Turon, mobile Athlon 64, power mobile Athlon 64, and mobile Sempron CPUs all support PowerNow. You'd probably need to keep track of a large list of different CPU models from different manufactures: Intel, AMD, Cyrix, VIA, and Transmeta. You could then construct a chain of "if" conditions that would determind whether to use the slow DOS interrupt or the fast ASM high resolution time() routines. Pete Eberlein demonstrates how to obtain CPU information with Euphoria machine code (EuASM). It doesn't seem to give any information about SpeedStep or PowerNow, but it gives you the basic idea. http://www.rapideuphoria.com/test_cpu.zip Although I'd love to have a fast time() routine, this would add much more ASM in the source code then ever before, thus potentially causing more porting difficulties. It wouldn't be to bad without the CPUID code, but without it, this particular implementation of time() probably couldn't exist without failing at some point. I think until there is a cleaner, less invasive method adopted, we should just stick with the library solutions. After reading this, you probably agree too. Regards, Vincent