Timer to find elapsed time in a function call in C

Posted by Mohit Nanda on Stack Overflow See other posts from Stack Overflow or by Mohit Nanda
Published on 2009-03-12T11:46:15Z Indexed on 2010/05/11 6:34 UTC
Read the original article Hit count: 192

Filed under:
|
|

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 please provide a sample code-snippet.

Pseudo code

Timer.Start()
foo();
Timer.Stop()
Display time elapsed in execution of foo()


Environment details: - using gcc 3.4 compiler on a RHEL machine

© Stack Overflow or respective owner

Related posts about timers

Related posts about c