标签:double 读取 oat 频率 rtti 返回 color apt bsp
测试一下速度,可以掌握运算或操作耗用时间,为掌握程序运行速度提供帮助。
//--------------------------------------------------------------------------- //测速 _LARGE_INTEGER iTestSpeed_StartTime; double fTestSpeed_Freq;//测速用频率 void __fastcall StartTiming(void)//开始计时 { _LARGE_INTEGER f; QueryPerformanceFrequency(&f);//读取频率 fTestSpeed_Freq = (double)f.QuadPart; QueryPerformanceCounter(&iTestSpeed_StartTime);//开始计时 } void __fastcall StopTiming(TForm *Form)//停止计时 { _LARGE_INTEGER iTestSpeed_StopTime; double fResult; QueryPerformanceCounter(&iTestSpeed_StopTime); fResult = ((double)(iTestSpeed_StopTime.QuadPart - iTestSpeed_StartTime.QuadPart) / fTestSpeed_Freq * 1000);//Ret ms Form->Caption = FormatFloat("0.0", fResult); } //---------------------------------------------------------------------------
开始时,使用StartTiming,结束时使用StopTiming,结果显示在窗体标题栏上。返回显示的单位是ms。
标签:double 读取 oat 频率 rtti 返回 color apt bsp
原文地址:https://www.cnblogs.com/hbg200/p/9147765.html