what is cum and flat mean?

2,444 views
Skip to first unread message

Yulei Xiao

unread,
Aug 25, 2015, 4:40:11 AM8/25/15
to golang-nuts
what is the meaning of flat, cum and others in pprof? Is there some document to descript it?


ROUTINE ======================== ExternalCode in /usr/local/go/src/runtime/proc.c
     460ms      460ms (flat, cum)  0.59% of Total

Jesper Louis Andersen

unread,
Aug 25, 2015, 5:22:08 AM8/25/15
to Yulei Xiao, golang-nuts
Usually, the 'flat' part tells you how much time was spent in a given function/routine/... whereas the 'cum' part refers to 'cumulative' and contains the current function/routine/... plus everything "above"/"below" it.

Suppose we sample the program and whenever we do, we obtain the stack of the program. the bottom of the stack explains where we currently are, and the stack itself tells us where we came from. After a run, we can gather together all the samples and have a rough estimate of where the program is spending its time by looking at the bottom of the stack. This is the flat profile, usually.

However, the stack itself is also interesting, because if you have two call paths a->b->c->d and a->b->c->e, and you are spending 1 second in d and 1 second in e, then you could say you are spending 2 seconds "below" c. Hence the "(ac)cumulative" time spent in c is 2 seconds.

I don't know the exact definition of the pprof output, but usually this is what happens in a sampling profiler, and you need a way to quickly discern how to interpret the price of paths in the call-graph of the program. In the view of the graph, c above would "dominate" d and e (provided c is the only way to get to d and e!)



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
J.
Reply all
Reply to author
Forward
0 new messages