Commit a4a03fc7 authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Arnaldo Carvalho de Melo
Browse files

perf evsel: Fix an issue where perf report fails to show the proper percentage

This patch fixes an issue where perf report shows nan% for certain
perf.data files. The below is from a report for a do_fork probe:

   -nan%           sshd  [kernel.kallsyms]  [k] do_fork
   -nan%    packagekitd  [kernel.kallsyms]  [k] do_fork
   -nan%    dbus-daemon  [kernel.kallsyms]  [k] do_fork
   -nan%           bash  [kernel.kallsyms]  [k] do_fork

A git bisect shows commit f3bda2c9 as the cause. However, looking back
through the git history, I saw commit 640c03ce which seems to have
removed the required initialization for perf_sample->period. The problem
only started showing after commit f3bda2c9. The below patch re-introduces
the initialization and it fixes the problem for me.

With the below patch, for the same perf.data:

  73.08%             bash  [kernel.kallsyms]  [k] do_fork
   8.97%      11-dhclient  [kernel.kallsyms]  [k] do_fork
   6.41%             sshd  [kernel.kallsyms]  [k] do_fork
   3.85%        20-chrony  ...
parent bf32c9eb
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment