質問

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