#include<stdio.h>
#include<time.h>
clock_t start,stop;
double duration;
int main()
{
start =clock(); //stop里面是从main开始走了多少ticks
myfunction();
stop=clock();
duration=((double)(stop-start))/CLK_TCK;//duration里面装了运行过程中的ticks数量。CLK_TCK里面存了计算机一秒走多少个ticks
return 0;
}
如何测量程序运行时间
最新推荐文章于 2021-07-01 19:05:54 发布