c++测试代码块所需时间(windows)
发布日期:2021-09-25 21:40:43 浏览次数:15 分类:技术文章

本文共 523 字,大约阅读时间需要 1 分钟。

#include 
#include
using namespace std;int main(){ double run_time = 0.0; //运行时间 _LARGE_INTEGER time_start; //起始时间 _LARGE_INTEGER time_over; //结束时间 _LARGE_INTEGER freq; double dqFreq; //计时器频率 QueryPerformanceCounter(&freq); dqFreq = (double)freq.QuadPart; QueryPerformanceCounter(&time_start); //测试for循环时间 for (int i = 0; i < 10000; i++) { } QueryPerformanceCounter(&time_over); run_time = 1000 * (time_over.QuadPart - time_start.QuadPart) / dqFreq; cout << run_time << "ms" << endl; getchar(); return 0;}

 

转载地址:https://blog.csdn.net/c_shell_python/article/details/106151508 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:再读Effective C++ 有感
下一篇:Qt实现 文件比较工具

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年03月31日 18时08分21秒