码迷,mamicode.com
首页 > 编程语言 > 详细

C语言计算机器运行时间

时间:2016-03-12 13:03:56      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

//计算机器运行时间

 

 

 

long i = 10000000L;
clock_t start, finish;
double duration;
//测量一个事件持续的时间
printf( "Time to do %ld empty loops is ", i) ;
start = clock();
while( i-- );
finish = clock();
duration = (double)(finish - start) / CLOCKS_PER_SEC;
printf( "%f seconds\n", duration );
system("pause");

C语言计算机器运行时间

标签:

原文地址:http://www.cnblogs.com/locean/p/5268327.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!