I am trying to figure a way to measure a process' system time.
The Unix's time command seems in effective because it only displays the result in seconds but my program is small so second is inappropriate.

I also tried to use gprof. However gprof uses atexit() to trace the exit point of the program; my program also uses this comamd so it turns out that gprof makes my program run incorrectly.

Is there any tool that is similar to "time" but display the result in nanosecond? (like the gettimeofday() in C)

Thank you very much!

Recommended Answers

All 3 Replies

See if there is a function called clock()

@WaltP: I was also thinking of using clock(). However, there is not much information on the specification of clock(), and it is also implementation-dependent. I was hoping to find a better method.
@Salem: Thank you very much! I think this is what I've been looking for!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.