用高精度计时器 #include <iostream> #include <windows.h> using namespace std ; int main(void) { LARGE_INTEGER BegainTime ; LARGE_INTEGER EndTime ; LARGE_INTEGER Frequency ; QueryPerformanceFrequency(&Frequency); QueryPerformanceCounter(&BegainTime) ; //要测试的代码放在这里 QueryPerformanceCounter(&EndTime) ; cout << ( EndTime.QuadPart - BegainTime.QuadPart )*1000 / Frequency.QuadPart ; system("pause") ; return 0 ; }
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)