三步走
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;
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/273168.html