Wally Highsmith wrote:
Does anyone know how to use PerformanceCounterType.ElapsedTime?
When I call calculate, it always returns some weired number between
15000 and 80000 which doesn't make sense.
The problem is that the PerformanceCounter runs at some frequency that
you may not expect. In Win32, QueryPerformanceCounter and
QueryPerformanceFrequency were sufficient to return the info needed to
make any timing calculations. In queryPerformanceType, documented here:
http://tinyurl.com/2arbl
It seems they have tried to maka a more useful class to encapsulate the
functions previously available, and add some new ones. In the
description of the ElapsedTime member, it says:
<quote>
Formula: (D0 - N 0)/ F, where D 0 represents the current time, N 0
represents the time the object was started, and F represents the number
of time units that elapse in one second.
</quote>
The problem is that they do not describe how to obtain F.
Perhaps if you explore some of the sample code on that page, you can
find it....