I do some i/o intensive programming in C on GNU/Linux and I would like to be able to trace all the i/o calls and to know the timings the application spends sleeping, waiting for IO for each call
Appart from the DIY method using gettimeoftheday everywhere, is there some tool to do that ? I want to be able to distinguish the calls from each other.
Ex of an output that would be usefull :
sendto at myprog.c:42 : 30µs recvfrom at myprog.c:48 : 45µs ...
Note: what I want is real time, not cpu time like profilers generally give.
Thanks
The
stracecommand has option-Twhich should do what you need. I checked the source code, it callsgettimeofday(2) to get the time, so it does report wall clock time, not CPU time.Example output from
strace -p 2956 -Ton my computer:The time is at the end of the line, in seconds. That’s 15 to 28 microseconds for the system calls in the example above.