[Mono-dev] Alternative to calculating Elapsed time using QueryPerformanceCounter
nikhil.jiet at gmail.com
Mon Apr 10 08:20:58 UTC 2017
QueryPerformanceCounter returns a monotonically increasing tick count.
Current we are using above mentioned Performance Counter and Performance
Frequency using “Kernel32.dll”.
Basically we use QueryPerformanceCounter to get a high resolution timer
value before and after the event you want to time.
Then use QueryPerformanceFrequency to get the number of ticks per second.
Divide the time difference by this value to convert the value to seconds.
alternatively we have thought to use stopwatch to achive same on Linux
using mono framrwork
Alternative way of Performance Counter and Performance Frequency by using
System. Diagnostics. Following are the code to find the same.
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
double elapsedMs = watch.ElapsedTicks;
However result we are getting on windows using QueryPerformanceCounter and
on Linux using Stopwatch have different precision Please find screenshot
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list