vs2010利用clock()计算代码运行时间

版本是vs2010,在网上看的一些方法只需要设置就可以看到运行时间,但是版本的缘故没办法通过设置显示,只能在代码中实现这个功能

clock_t start,stop;
double duration;
int main()
{
start=clock();
my_function();//这是我要计算的函数的运行时间
stop=clock();
duration=((double)(stop-start))/CLK_TCK;
printf("%.4f",duration);
return 0;
}

  通过以上方法就可以在输出的控制台中显示程序运行时间

原文地址:https://www.cnblogs.com/redzzy/p/14266993.html