8

Question

In Perf’s annotate view, the runtime consumed by each instruction is given on the left side as a percentage. Is there some option to have some absolute quantity (probably samples) displayed instead?

Background

I am using some C code with classical C arrays as well as with Numpy Arrays (for use in a Python module) and I want to compare the performances by having it run on some identical example cases. There are certain parts (e.g., initialisation) whose performance I know to differ and which I am not interested in. However, these affect the total runtime and thus render the percentage values for the other parts uncomparable – unless I want to transform the values myself. If I could access the total runtimes, I could easily compare the different variants piece by piece.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Wrzlprmft
  • 4,234
  • 1
  • 28
  • 54
  • Have you tried `perf report` – Milind Dumbare Mar 02 '15 at 12:51
  • @Miline: That’s how I usually get to the annotate view (though I am aware of `perf annotate`). Any not source-code based view is not sufficiently detailled for me. – Wrzlprmft Mar 02 '15 at 13:01
  • 2
    `perf report -n` shows samples; use `perf record -F 1000` to set sample frequency to 1000 per second. `annotate` may also have `-n`... Easier way is to add timing directly to your code to have direct time to time comparison – osgx Mar 03 '15 at 07:59
  • @osgx: That is not a comment, but an answer, albeit a wrong one. `perf report -n` does not lead to samples being shown in annotate mode, `perf annotate` does not have `-n`. Adding time evaluations directly to my code would be a horrible idea as it destroys several compiler optimisations. – Wrzlprmft Mar 03 '15 at 08:35

1 Answers1

0

It appears that the flag -n showing samples has been added to perf annotate in 2017. I haven’t tested it yet though.

Wrzlprmft
  • 4,234
  • 1
  • 28
  • 54