我想知道某个代码块的执行时间(大约).比如:
startStopwatch();
// do some calculations
stopStopwatch();
printf("%lf", timeMesuredInSeconds);
怎样
我想知道某个代码块的执行时间(大约).比如:
startStopwatch();
// do some calculations
stopStopwatch();
printf("%lf", timeMesuredInSeconds);
怎样
你可以在time.h分钟内使用clock
方法
示例:
clock_t start = clock();
/*Do something*/
clock_t end = clock();
float seconds = (float)(end - start) / CLOCKS_PER_SEC;