#include <stdio.h>
#include <time.h>
clock_t start, stop;
//clock_t是clock()函数返回值的数据变量类型
double duration;
//记录被测函数的运行时间,以秒为单位
int main()
{
//不在测试范围内的准备工作写在clock()调用之前
start = clock(); //开始计时
MyFunction(); //把被测函数添加在这里
stop = clock(); //结束计时
duration = ((double)(stop - start)) / CLOCKS_PER_SEC;
//其他不在测试范围内的处理写在后面,例如输出duration的值
printf("ticks for f1 = %lf ms\n", (double)(stop - start)); //毫秒
printf("duration for f1 = %lf s\n", duration); //秒
return 0;
}