function for timing in microseconds? 
Author Message
 function for timing in microseconds?

We are looking for a function in Visual C++ that will allow us to measure
time in microseconds with reasonable resolution.
The clock() function running in windows95  does not seem to give us the
resolution we're after.
Any suggestions, please send us an email or answer here in newsgroup.

cheers.

Ralf & Euan



Fri, 16 Nov 2001 03:00:00 GMT  
 function for timing in microseconds?
Check out QueryPerformanceFrequency() and QueryPerformanceCounter().

TFM3

Note: spam-resistant e-mail address


Quote:
>We are looking for a function in visual C++ that will allow us to measure
>time in microseconds with reasonable resolution.
>The clock() function running in windows95  does not seem to give us the
>resolution we're after.
>Any suggestions, please send us an email or answer here in newsgroup.

>cheers.

>Ralf & Euan



Fri, 16 Nov 2001 03:00:00 GMT  
 function for timing in microseconds?


Quote:
> We are looking for a function in visual C++ that will allow us to measure
> time in microseconds with reasonable resolution.
> The clock() function running in windows95  does not seem to give us the
> resolution we're after.

You can't do this on Windows95, or any windows environment.
Excursions to do disk upkeep will be many milliseconds at least.
Check the average seek time on your hard drive, and how long
it takes to read in or write out a swapped page.

Even if you had a function that reported time in small enough
increments, you could not use it to time things at the microsecond
time scale, because the platform "goes away" for much longer
times than that on a regular basis.

You likely need some specialized hardware. Something like a
timer board you could plug into your PC and then send commands
to and get data from.

--
Dan Evens
(Standard disclaimers etc. No spam please.)



Sat, 17 Nov 2001 03:00:00 GMT  
 function for timing in microseconds?
Dan,

I must beg to differ with much of what you say here.

QueryPerformanceFrequency() and QueryPerformanceCounter() are available on
both Win9x and WinNT.  I've used them, they work.  I don't have any special
timer board in my PC.

On my machine (PII-400) QueryPerformanceFrequency() returns a number
slightly over 1,000,000.  This means that the resolution of the timer is
less than 1 microsecond.  Consecutive calls to QueryPerformanceCounter()
took 4-5 microseconds. (With adequate testing this 4-5 microsecond lag could
be factored out.)

While some of what you say related to disk access and preemptive
multi-tasking is true, it does not negate the validity of the
high-resolution timer.  It merely introduces things that need to be
considered when evaluating the results.

The original poster was "looking for a function in visual C++ that will
allow us to measure
time in microseconds with reasonable resolution".  The high-resolution timer
might be quite appropriate for their purposes.

TFM3

Note: spam-resistant e-mail address

Quote:

>You can't do this on Windows95, or any windows environment.
>Excursions to do disk upkeep will be many milliseconds at least.
>Check the average seek time on your hard drive, and how long
>it takes to read in or write out a swapped page.

>Even if you had a function that reported time in small enough
>increments, you could not use it to time things at the microsecond
>time scale, because the platform "goes away" for much longer
>times than that on a regular basis.

>You likely need some specialized hardware. Something like a
>timer board you could plug into your PC and then send commands
>to and get data from.

>--
>Dan Evens
>(Standard disclaimers etc. No spam please.)




Sat, 17 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. microsecond timing delays in Visual C/C++

2. How to find currnet time in Microseconds?

3. How to get Julian time and microseconds?

4. How to get microseconds from Julian time

5. How to measure microsecond time intervals?

6. Microsecond timing accuracy

7. Time in Microseconds !!!

8. Time in Microseconds !!!

9. <HELP> microsecond timing resolution using C.

10. microsecond timing...

11. Sleeping for times accurat to a microsecond under NT

12. Get current time microseconds

 

 
Powered by phpBB® Forum Software