perf report: Tell the user when a perf.data file has no samples
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Feb 2011 16:40:46 +0000 (14:40 -0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Feb 2011 16:40:46 +0000 (14:40 -0200)
[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 <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-report.c

index f9a99a1ce609a82af1d3b5ee7eb3ad074e57fdb9..dddcc7ea2bec37609744f7cf6cf3c906dd02d292 100644 (file)
@@ -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;
 
This page took 0.028787 seconds and 5 git commands to generate.