C语言计算机器运行时间

//计算机器运行时间

 

 

 

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");

posted @   ocean2015  阅读(198)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示