Best timing method in C?

前端 未结 6 987
广开言路
广开言路 2020-11-28 18:55

What is the best way to time a code section with high resolution and portability?

/* Time from here */
ProcessIntenseFunction();
/* to here. */

printf(\"Tim         


        
6条回答
  •  时光说笑
    2020-11-28 19:22

    gettimeofday will return time accurate to microseconds within the resolution of the system clock. You might also want to check out the High Res Timers project on SourceForge.

提交回复
热议问题