我想知道是否有用于精确时间测量(如函数的执行时间)的“.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);
最佳答案
The Stopwatch是一个高分辨率框架计时器类(可能包装了该 api)。
关于C# 替换 PerformanceCounter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/546014/