Skip to contentSkip to conversation

perf report: Tell the user when a perf.data file has no samples

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Feb 18, 2011 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  74cfc17dc1a69c37ce6c8a76c1ce84bcb796eb0e
Gitweb:     http://git.kernel.org/tip/74cfc17dc1a69c37ce6c8a76c1ce84bcb796eb0e
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 17 Feb 2011 14:40:46 -0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 17 Feb 2011 14:40:46 -0200

perf report: Tell the user when a perf.data file has no samples

[root@emilia ~]# perf report --stdio The perf.data file has no samples! [root@emilia ~]#

The TUI shows a popup warning message with the same message.

Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Tom Zanussi <[email protected]>

LKML-Reference: <new-submission>

---
 tools/perf/builtin-report.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/perf/builtin-report.c +6 -0
index f9a99a1..dddcc7e 100644
@@ -350,6 +350,12 @@ static int __cmd_report(void)
 		perf_session__fprintf_dsos(session, stdout);
 
 	next = rb_first(&session->hists_tree);
+
+	if (next == NULL) {
+		ui__warning("The %s file has no samples!\n", input_name);
+		goto out_delete;
+	}
+
 	while (next) {
 		struct hists *hists;