QueryPerformance : C++精确计时开箱即用
作者:互联网
三步走
step 1 包含头文件
#include <windows.h>
step2 下面的代码放在计时开始处
LARGE_INTEGER tbg, tend, tfre; QueryPerformanceFrequency(&tfre); //开始计时 QueryPerformanceCounter(&tbg);
step 3 下面的代码放在计时结束处
//结束计时 QueryPerformanceCounter(&tend); double locateTime = (double)(tend.QuadPart - tbg.QuadPart) / (double)tfre.QuadPart; std::clog << "locateTime = " << locateTime << " s" << std::endl;
标签:QueryPerformance,double,C++,tend,开箱,tfre,QuadPart,计时,tbg 来源: https://www.cnblogs.com/Grit-Walker/p/16458199.html