Alex Rivera | Logout

fast elapsed time on linux

Asked 2009-09-04T16:01:04.297
9

I am looking for a fast way to get the elapsed time between two calls of a function in C.

I considered using jiffies, but they are not available in userland. So, should I use getimeofday() or is there any fastest way to do this.

I am only interested in the elasped time between two calls, to use in a benchmark tool.

Edit
Report

1 Answer

0

Bit of a late addition, however the time uility available on any linux/unix may be a lighter weight way of achieving what you want. Here are 2 examples

time ls -l stuff*
ls: stuff*: No such file or directory
    0.01s real     0.00s user     0.00s system


 time -c run_script.csh` 

...

real    1m22.38s
user    0m14.67s
sys     0m1.06s
answered 2009-12-09T15:28:44.230

Your Answer