Re: High resolution timer.



Tim Roberts schrieb:
Hendrik van der Heijden <spamtrap@xxxxxxxxxx> wrote:
Sergey.skv schrieb:
I need to implement low cost high resolution timer (on a scale of
1ms) . It should run on Windows and Linux so there is no Win32 API.
The first thing to use is RDTSC. Every body express concern about CPU
throttling. What about multiple CPUs. Does RDTSC return the same
number for different CPUs?
Use QueryPerformanceCounter / QueryPerformanceFrequency
on Windows and gettimeofday on Linux.
Those are independent of CPU cores and clock changes.

Unfortunately, that's not true. On a multiprocessor machine,
QueryPerformanceCounter returns the raw cycle counter. The returned value
can even go backwards if you switch CPUs.

Afaik, the idea is that QueryPerformanceCounter should not have
the problems of RDTSC with core migration and changing clok frequency.

However, there were patches from MS (KB896256) and AMD to get
the intended behaviour right on multicore/MP systems.


Hendrik vdH

.



Relevant Pages

  • Re: hmm..interesting
    ... variants on x86 architecture, PowerPC, etc. Linux has its uses ... Given that machines that run Software-based Risc OS currently are ... basically Windows PCs that boot up to fire up WINE on startup and then ... OS is a good bet for a multi-CPU workstation running ARM cpus? ...
    (comp.sys.acorn.advocacy)
  • Apple: what will happen the day money gets really tight?
    ... It would be kinda hard to convince a Linux user to switch to a PC with the Apple tax. ... It's only that M&M always insist that Windows is lame, so I've got to remind them there are alternatives: ... it suddenly appeared that their CPUs were a flop and they switched to straight little endian Intel CPUs. ...
    (comp.sys.mac.system)
  • Re: High resolution timer.
    ... It should run on Windows and Linux so there is no Win32 API. ... What about multiple CPUs. ... Use QueryPerformanceCounter / QueryPerformanceFrequency ...
    (comp.lang.asm.x86)
  • Re: High resolution timer.
    ... It should run on Windows and Linux so there is no Win32 API. ... The first thing to use is RDTSC. ... Those are independent of CPU cores and clock changes. ...
    (comp.lang.asm.x86)
  • Re: Are 80x86 badly designed processors ?
    ... > How many people will then buy such a CPU that Windows does not support? ... boxes running properly in 64 bit mode unser IRIX and Linux. ... So, in conclusion, there is a market for good CPUs that aren't supported ...
    (comp.lang.asm.x86)