LNT server function perf profile comparison

Hi!

I have implemented a security feature in LLVM and now I want to evaluate the performance impact by comparing the perf profile of the originally compiled program and the modified program. For that I have run a benchmark with lnt runtest test-suite and –use-perf=all. I can compare the recorded counters in the lnt runserver webinterface perfectly fine with the side by side comparison. However, as soon as I switch from “Relative (%)” to “Absolute numbers”, one side of the comparison only displays 0 anymore. Is this normal behavior or is something with my lnt server / perf profiles broken?

You can see a screenshot of how it looks like here: https://ibb.co/dDnZp5T

Regards,

Felix

Hi Felix,

This is not really expected behaviour.
Are you getting “0” for all instructions, or only for some where you didn’t expect it?
Are you sure the function you show in the screenshot actually still gets called in the transformed program?

FWIW and orthogonally - I’d recommend using the View: “Control-Flow Graph (X86-64)”. That way, you’ll get counters aggregated per basic block, which removes a bit some of the confusion that can result when perf associates events with an instruction a number of instructions removed from the instruction causing the event you were measuring.

Hoping this helps a little,

Kristof

Hi Kristof!

Are you getting “0” for all instructions, or only for some where you didn’t expect it?

Basically for all instructions which had a legit value before. If I only look at a single function at a time (e.g. on the left side), I can choose “Absolute numbers” and see the correct numbers. But as soon as I do it with two functions, I only see the numbers for one of the functions (the right one).

Are you sure the function you show in the screenshot actually still gets called in the transformed program?

Yes, I think they should be called. In the screenshot I used the same program with –O0 vs –O2.

The functions I am usually comparing are only called in the left or the right program respectively. The modified program contains a slightly modified clone of the original function and calls the modified clone instead of the original one. The modified clone simply contains a few extra instructions. That is, the function on the left is not called in the right program and vice versa. I would rather like to compare the slightly modified clone with the original function. What puzzles me is that displaying relative numbers works, whereas absolute numbers do not.

Hmmm - that seems strange indeed. I’m afraid all I can say is that I haven’t seen this behaviour before. I’m afraid you may have to start debugging the javascript driving this webpage to drill down to the root cause of this issue…
FWIW, the source code of the (probably) relevant javascript lives at https://github.com/llvm/llvm-lnt/blob/master/lnt/server/ui/static/lnt_profile.js. All of the code until line 638 seems to be about producing the CFG view. Given you have the issue also without the CFG view, you can probably ignore that part. I’m afraid that even ignoring that part, it is still quite a bit of code…