From: Arnaldo Carvalho de Melo Date: Thu, 17 Feb 2011 16:40:46 +0000 (-0200) Subject: perf report: Tell the user when a perf.data file has no samples X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=74cfc17dc1a69c37ce6c8a76c1ce84bcb796eb0e;p=deliverable%2Flinux.git 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. Reported-by: Ingo Molnar Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Steven Rostedt Cc: Tom Zanussi LKML-Reference: Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index f9a99a1ce609..dddcc7ea2bec 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -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;