一堆代码,总运行时间很久,程序界面假死,如何判断哪段代码耗时最多?
CommonLib::ToolKit::CPerfTimer timer;
timer.Start();
代码段1;
t = timer.GetUs();
qDebug("combine string time = %f us\r\n",t);
timer.Start();
代码段2;
t = timer.GetUs();
qDebug("SendPoint time = %f us\r\n",t);
别忘记包含头文件
#include "CPerfTimer.h"
这样就可以判断出那段程序段耗时长,对应的去处理了;
是不是很直观?