RE: [GD-Windows] More timer fun!
Brought to you by:
vexxed72
From: Grills, J. <jg...@so...> - 2002-09-02 19:20:52
|
How could people possibly want to use a function that's broken and will return incorrect values occasionally? I bet most programmers out there that use QPC aren't even aware of the problems that it has, especially if they don't manifest on their development machines. Even Tom Forsyth, whom most of us would say is a reasonably intelligent programmer, had problems with clock drift on non-development machines using timeGetTime(). Can we expect as much from your average run of the mill programmer? I think not. Would you use sqrt() if it occasionally returned the wrong result? I wouldn't. Would you be willing to have sqrt() take twice the time if the results it returned were always correct? I would. MS is in the unique position to know enough about the actual hardware to understand if the system has these problems with QPC, and avoid the extra overhead if the hardware is reliable. If there really is some major resistance to QPC() getting slower, then MS should provide us a new routine, whatever the name, that actually works. It shouldn't be my responsibility to write code to figure out the proper time to a reasonable degree of precision -- that's a job for the operating system. j -----Original Message----- From: Jon Watte [mailto:hp...@mi...] Sent: Monday, September 02, 2002 1:56 PM To: Grills, Jeff; gam...@li... Subject: RE: [GD-Windows] More timer fun! > and that we can apparently fix this within our games with enough work, > Microsoft should integrate fixes for this into their current and > past OS's. QueryPerformanceCounter() is slow enough already (on the order of 1 microsecond because of the bus transaction involved). Fixing it is decidedly non-trivial, and, at a minimum, requires doubling the cost of calling it. I think most people who use these functions would rather not take the additional cost hit. RDTSC doesn't skip, that I've heard of. It's absolutely the right thing to use for profiling and similar measurements. The only weakness of it is that it may not measure wall-clock time accurately on laptops (that use TimeStep CPUs). I'm prepared to live with that on a local scale, and to use an unholy heuristic trio of QPC/timeGetTime()/RDTSC for keeping track of wallclock time on a global scale. Cheers, / h+ |