I have a function which it taking 11 seconds.
I want to profile how much time it is spending in I/O.
Is there any tool for for profiling I/O time spend inside a function ?
Which can give statics like
Total Time I/O TIME Function Name
x y f
This method will tell you.
Just pause it like 10 times.
Each time look at the stack.
If you catch it in the process of doing IO on, say, 6 of those pauses, that means about 60% of its time is in IO.
If you want to know how much of that was spent in IO requested by function F, just count the number of samples that were doing IO when function F was on the stack.
(gprof will not tell you this, because it suspends sampling during IO.)
Added: Alternatively, you could just stub out the IO calls in function F, and measure overall time with and without IO.