Calculating the speed of routines?

后端 未结 8 755
自闭症患者
自闭症患者 2020-12-08 00:26

What would be the best and most accurate way to determine how long it took to process a routine, such as a procedure of function?

I ask because I am currently trying

8条回答
  •  误落风尘
    2020-12-08 01:01

    clock_gettime() is the high solution, which is precise to nano seconds, you can also use rtdsc, which is precise to CPU cycle, and lastly you can simply use gettimeofday().

提交回复
热议问题