All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] Perf: Fix an issue where perf report fails to show the proper percentage
@ 2012-02-03 17:01 Naveen N. Rao
  2012-02-07 19:36 ` [tip:perf/core] perf evsel: " tip-bot for Naveen N. Rao
  0 siblings, 1 reply; 2+ messages in thread
From: Naveen N. Rao @ 2012-02-03 17:01 UTC (permalink / raw)
  To: acme, mingo, linux-kernel; +Cc: robert.richter, ananth, srikar

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 f3bda2c as the cause. However, looking back through
the git history, I saw commit 640c03c which seems to have removed the
required initialization for perf_sample->period. The problem only started
showing after commit f3bda2c. 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  [kernel.kallsyms]  [k] do_fork
   2.56%         sendmail  [kernel.kallsyms]  [k] do_fork

This patch applies over current linux-tip commit 9949284.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 tools/perf/util/evsel.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index dcfefab..9a11f9e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -463,6 +463,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
 	memset(data, 0, sizeof(*data));
 	data->cpu = data->pid = data->tid = -1;
 	data->stream_id = data->id = data->time = -1ULL;
+	data->period = 1;
 
 	if (event->header.type != PERF_RECORD_SAMPLE) {
 		if (!sample_id_all)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-07 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-03 17:01 [RFC PATCH] Perf: Fix an issue where perf report fails to show the proper percentage Naveen N. Rao
2012-02-07 19:36 ` [tip:perf/core] perf evsel: " tip-bot for Naveen N. Rao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.