On 07/14/2010 06:26 PM, Javier Sanz wrote:
> Does OProfile provide any way to include code that is idle in the call
> graphs? So that, for example, if a function spends 4 seconds in a
> sleep(4) call, and another function spends 4 seconds on real
> calculations (CPU time), both would be shown in the same position of
> the reports. That way OProfile could also be used when profiling
> systems where the bottleneck is not the CPU, but disk IO, network IO,
> or lock contention.
> Particularly it's lock contention what I'm after. If OProfile cannot
> measure this, any suggestion better than taking random call stack
> snapshots with gdb would be appreciated.
OProfile is doing statistical sampling. Those samples show where those event happen. OProfile isn't so good for showing when something is waiting (latency between events).
You might look at SystemTap as a way to get information when a program is waiting.
There are a number of examples and some of them might be close to what you want:
What kind of lock contention are you look at? kernel- or user- space? The user-space locking is built on futex and could instrument the futex system calls to see what you are waiting for (process/futexes.stp). The process/schedtimes.stp example can give a break down of run, sleep, io_wait, queued (waiting for processor).