The FFTW project has a nice header with portable cycle counters. http://www.fftw.org/cycle.h
Michael ________________________________ From: Rush Manbert <[email protected]> Reply-To: <[email protected]> Date: Thu, 28 May 2009 08:01:01 -0700 To: <[email protected]> Subject: Re: Windows Timers - Seeking Opinions Hi Patrick, On May 27, 2009, at 4:18 PM, Patrick Schlangen wrote: > Sorry for asking this, but which parts in the Thrift Library rely on > timers? Used in ThreadManager, TimerManager, and TFileTransport. Also used in the tests, particularly after I modified them to remove race conditions and added new tests. (Waiting for threads under test to do something.) > > > The timeGetTime() thing sounds good and linking against winmm.dll > should not cause problems. But I am wondering where winmm.dll gets > its time information from and if you could access it at a lower level? Some interesting links about the various timers: http://www.virtualdub.org/blog/pivot/entry.php?id=106 http://www.b500.com/~hplus/misc/simple-timer.html http://www.b500.com/~hplus/pc-timers.html Those are some of the things I read while trying to put something together. After reading your reply, I did a search for windows time stamp counter and came up with this: http://en.wikipedia.org/wiki/Time_Stamp_Counter On that page, there is a link that is titled "Using the Processor Clocks" that links to an Intel document that discusses the different timers. This is the most recently published document that I have seen, except for Microsoft docs. The "Enhanced Timer" section suggests that QueryPerformanceCounter should really be constant frequency. I will take another look at my code that uses it, and test it again. The "Using the Multimedia Function timeGetTime" section doesn't tell you what the nultimedia timer really is, so I don't know how to access it at a lower level. You also need to specify the resolution that you want, so the code looks like this: timeBeginPeriod((UINT)1); tickCount = timeGetTime(); timeEndPeriod((UINT)1); Best regards, Rush
