Timer to find elapsed time in a function call in C

后端 未结 11 1643
故里飘歌
故里飘歌 2020-12-09 14:20

I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond.

Is there a timer function available in C to do it?

If yes ple

11条回答
  •  心在旅途
    2020-12-09 14:43

    There is no timer in c which has guaranteed 1 nanosecond precision. You may want to look into clock() or better yet The POSIX gettimeofday()

提交回复
热议问题