This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

如何测量6678代码运行时间?



我现在的方法是#include <time.h>

    start = clock();
    finish = clock();
    overhead = finish - start;
    start = clock();
/* code part */

    finish = clock();
    duration1 = (double)(finish - start - overhead)/ CLOCKS_PER_SEC ;
    printf("filter time : %f s\n", duration1);

但是测出来的时间比代码实际运行的时间短了许多,感觉并不正确,要如何测量时间呢?