I'm wondering if there is a ".net integrated" solution for exact time measurement (like the execution time of a function)? At the moment I'm using the PerformanceCounters from Kernel32.
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceCounter(
out long lpPerformanceCount);
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceFrequency(
out long lpFrequency);
The Stopwatch is a high resolution framework timer class (that probably wraps that api).
Try
Both of these work well for finer resolution and straightforward usage.
You could also see
What is the best way to measure execution time of a function?
or
What's the best way to benchmark programs in Windows?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With