计录运行时间的方法

#include<stdio.h>
#incude<time.h>//计时的头文件 
clock_t start,stop;//clock_t 是clock()函数返回的变量类型 
double duration;
int main()
{
	start=clock();//开始计时
	MyFunction() ;//要测试运行时间的函数 
	stop=clock();//停止计时 
	duration=((double)(stop-start))/CLK_TCK;//运行时间duration,CLK_TCK为机器时钟每秒的时钟打点数 
	return 0;
}
原文地址:https://www.cnblogs.com/clanguageweaver/p/6662380.html