fast elapsed time on linux

c, linux, time

Solution

Take a look at `clock_gettime`, which provides access to high-resolution timers.

Problem

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.

Original source

Related problems