OProfile sample means self or inclusive?

257 Views Asked by At

The samples given by OProfile in the flat report, are they the samples for the function itself, or they are the samples for the function itself plus samples for the functions it calls? I tried to look at the docs, tutorials but could not find a concrete answer. My feeling is that it is samples for self, more precisely, the number of samples when the CPU is executing instructions for the body of the function but not in the function it calls.

1

There are 1 best solutions below

4
On

It's hard to tell from the doc, but if you have turned on stack sampling, it seems to say that every return address on the stack is treated as if it is a program-counter sample. If it does that, then the time would be inclusive, provided it handles recursion properly.

To handle recursion properly, if a function appears more than once on a sample, it should only be counted once.

Also, I can't tell from the doc if the samples are suspended during I/O or sleeps, which they should not be, unless you want to be blind to those.