LARGE_INTEGER litmp;
LONGLONG QPart1,QPart2;
double dfMinus, dfFreq, dfTim;
QueryPerformanceFrequency(&litmp); //获得计数器的时钟频率
dfFreq = (double)litmp.QuadPart;
QueryPerformanceCounter(&litmp); //获得初始值
QPart1 = litmp.QuadPart;
//----------------------------------------------
// 插入你要测试的代码或函数
//----------------------------------------------
QueryPerformanceCounter(&litmp); //获得中止值
QPart2 = litmp.QuadPart;
dfMinus = (double)(QPart2 - QPart1);//获得对应的时间值
dfTim = dfMinus / dfFreq;
CString strrr;
strrr.Format("%f", dfTim*1000000);
strrr += "微秒";
AfxMessageBox(strrr);
MFC下测量程序执行时间
最新推荐文章于 2024-08-16 10:13:06 发布