Re: Accuracy of System.Diagnostics.Stopwatch by Brian
Brian
Thu Oct 20 11:01:36 CDT 2005
Scott,
Check the Stopwatch.Frequency field. It will return the number of
ticks per second. I suspect the class wraps the
QueryPerformanceCounter and QueryPerformanceFrequency APIs if there is
a high resolution hardware counter on the box so it's likely to be very
accurate.
Brian
Homer Simpson wrote:
> Does anyone have any experience and/or documentation concerning the accuracy
> of the stopwatch class? How does it calculate the elapsed time? I read
> somewhere Stopwatch could be used for performance testing of various methods
> and would like to know how accurate it is.
>
> Thanks,
> Scott