Re: [RFC][PATCH 7/7] perf/annotate: Add branch stack / basic block information

From: Peter Zijlstra
Date: Thu Sep 08 2016 - 14:16:07 EST


On Thu, Sep 08, 2016 at 09:43:53AM -0700, Stephane Eranian wrote:

> I like the idea and yes, branch stack can be used for this, but I have
> a hard time understanding the colored output.

> What is the explanation for the color changes?

In general, or the changes acme made? I can only answer the first.

For code: NORMAL <1%, BLUE otherwise, quickly shows you the code in a
function that's not ran at all. This quickly eliminated a big chunk of
the function I was looking at at the time, since the benchmark in
question simply didn't touch most of it.

For address: NORMAL <1%, RED > 75%, MAGENTA otherwise. Quickly shows the
hottest blocks in a function. The 75% is a random number otherwise. Not
sure if we can do better.

> How do I interpret the percentages in the comments of the assembly:
> -54.50% (p: 42%)

-54.50% is 54.40% of the coverage is leaving here, aka 54.40% take this
branch. p: 42% mean the branch is predicted 42% of the time.

Similarly, +50.46% is a branch target and means that of all the times
this instruction gets executed, 50.46% of those joined at this
instruction.

> Why not have dedicated columns before the assembly with proper column headers?

I found it too noisy, you only want to annotate branch instructions and
branch targets. Adding columns just adds a whole heap of whitespace
(wasted screen-estate) on the left.

Something I did want to look at was attempting to align the # comments,
but I never did bother.

But to each their own I suppose.