I want to measure the running time of a specific system call, for example, I want to know a pread need how many time on both CPU and I/O.

Which function should I use?

Now I usetimes, and it works.

gettimeofday is get the current time, and that may not just calculate the running time of a specific process, right?

clock is return the CPU time this program used so far, does this include the I/O time? If there are other programs running, will this influence the time of this function? I mean something like switching running process.

getrusage seems like a ideal one, but it also returns the CPU time of a specific process.

Does anyone know how benchmark tools like iozone calculate system calls time? I've read its code, and still have no idea.

没有正确的解决方案

其他提示

You're looking for times(2).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top