我想知道是否有一个".net集成“的解决方案来精确测量时间(比如函数的执行时间)?目前,我使用的是Kernel32的PerformanceCounters。
    [DllImport("Kernel32.dll")]
    private static extern bool QueryPerformanceCounter(
        out long lpPerformanceCount);
    [DllImport("Kernel32.dll")]
    private static extern bool QueryPerformanceFrequency(
        out long lpFrequency);发布于 2009-02-13 13:58:57
The Stopwatch是一个高分辨率的框架timer类(它可能封装了这个api)。
发布于 2009-02-13 14:01:03
试一试
这两种方法都能很好地实现更好的分辨率和简单的用法。
您还可以看到
What is the best way to measure execution time of a function?
或
https://stackoverflow.com/questions/546014
复制相似问题