views:

483

answers:

2

Hi,

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);
+12  A: 

The Stopwatch is a high resolution framework timer class (that probably wraps that api).

BC
It appears to be hardware and OS dependent, so it will be high resolution for windows, at least.
BC