DWORD t0, tt; // DWORD = unsigned long
//计时开始
t0 = GetTickCount(); // 返回“毫秒”
//处理过程
//...............
//...............
//计时结束
tt = GetTickCount();
CString msg;
msg.Format("用时 %.3f 秒", (t1-t0)/1000.0);
AfxMessageBox(msg);
本文介绍了一种使用C++进行程序运行时间测量的方法。通过`GetTickCount()`函数记录程序开始和结束的时间点,计算并显示程序运行的总耗时。
DWORD t0, tt; // DWORD = unsigned long
//计时开始
t0 = GetTickCount(); // 返回“毫秒”
//处理过程
//...............
//...............
//计时结束
tt = GetTickCount();
CString msg;
msg.Format("用时 %.3f 秒", (t1-t0)/1000.0);
AfxMessageBox(msg);
被折叠的 条评论
为什么被折叠?
&spm=1001.2101.3001.5002&articleId=2071065&d=1&t=3&u=186c8d05d9c54237b7de5a7f1ea2d183)