public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report
@ 2015-03-19 13:58 Yunlong Song
  2015-03-23  0:44 ` Namhyung Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Yunlong Song @ 2015-03-19 13:58 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme; +Cc: linux-kernel, wangnan0

When '--sort' is not set, 'perf mem report" will print a null pointer as
the output value of sort order, so fix it.

Example:

Before this patch:

 $ perf mem report
 # To display the perf.data header info, please use --header/--header-only options.
 #
 # Samples: 18  of event 'cpu/mem-loads/pp'
 # Total weight : 188
 # Sort order   : (null)
 #
 ...

After this patch:

 $ perf mem report
 # To display the perf.data header info, please use --header/--header-only options.
 #
 # Samples: 18  of event 'cpu/mem-loads/pp'
 # Total weight : 188
 #
 ...

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
---
 tools/perf/builtin-report.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 52f74e1..918ffef 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -304,7 +304,8 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 
 	if (rep->mem_mode) {
 		ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
-		ret += fprintf(fp, "\n# Sort order   : %s", sort_order);
+		if (sort_order)
+			ret += fprintf(fp, "\n# Sort order   : %s", sort_order);
 	} else
 		ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
 	return ret + fprintf(fp, "\n#\n");
-- 
1.8.5.2


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

end of thread, other threads:[~2015-03-24 16:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 13:58 [PATCH] perf tools: Remove (null) value of "Sort order" for perf mem report Yunlong Song
2015-03-23  0:44 ` Namhyung Kim
2015-03-23  3:50   ` [PATCH v2] " Yunlong Song
2015-03-23 16:15     ` Arnaldo Carvalho de Melo
2015-03-23 23:38       ` Namhyung Kim
2015-03-24  2:03       ` Yunlong Song
2015-03-24 16:30     ` [tip:perf/core] " tip-bot for Yunlong Song
2015-03-23  3:58   ` [PATCH] " Yunlong Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox