Re: Problem with QueryPerformanceCounter
From: Corey Murtagh (emonk_at_slingshot.no.uce)
Date: 01/08/04
- Next message: Corey Murtagh: "Re: Tata Consulting India"
- Previous message: R. Steve Walz: "Re: What IS Intelligence"
- In reply to: Atri Mandal: "Problem with QueryPerformanceCounter"
- Next in thread: ak: "Re: Problem with QueryPerformanceCounter"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 08 Jan 2004 17:06:13 +1300
Atri Mandal wrote:
> Hi,
> I'm using the QueryPerformanceCounter() method to calculate the elapsed
> time in a block of code.
> It actually gave me results that I didn't expect so I tried testing with
> this code..
<snip>
> So between two calls to the timer function QueryPerformanceCounter() I
> have made a call to sleep(5) and so the calculated time should be 0.005
> i.e. 5 milliseconds.
> But for the first 5 runs of this program I got the following values for
> duration and none was nowhere near 0.005:-
> 0.002048 s
> 0.006090 s
> 0.008316 s
> 0.006245 s
> 0.009147 s
Which version of Windows are you using? If it's Win9x then the above
figures aren't out of the question, since the timing of the Sleep API is
fairly random at that level on Win9x. You should see similar variation
with larger sleep times. If you're on WinNT the above times are... odd,
to say the least.
The thing to keep in mind is that Sleep() isn't very precise. There are
all sorts of factors that can mess with the timing of it, including
system load and process scheduler settings.
-- Corey Murtagh The Electric Monk "Quidquid latine dictum sit, altum viditur!"
- Next message: Corey Murtagh: "Re: Tata Consulting India"
- Previous message: R. Steve Walz: "Re: What IS Intelligence"
- In reply to: Atri Mandal: "Problem with QueryPerformanceCounter"
- Next in thread: ak: "Re: Problem with QueryPerformanceCounter"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|