MFC下测量程序执行时间

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);   

 

 

 

转自:http://www.vckbase.com/document/viewdoc/?id=1301

你可能感兴趣的:(测试,Integer,mfc)