Commit 55717314 authored by Ingo Molnar's avatar Ingo Molnar

pref_counter: tools: report: Robustify in case of weird events

This error condition:

  aldebaran:~/linux/linux/Documentation/perf_counter> perf report
  dso__load_sym: cannot get elf header.
  failed to open: /etc/ld.so.cache
  problem processing PERF_EVENT_MMAP, bailing out

caused the profile to be very short - as the error was at the beginning
of the file and we bailed out completely.

Be more permissive and consider the event broken instead.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 2d65537e
...@@ -1117,9 +1117,9 @@ static int __cmd_report(void) ...@@ -1117,9 +1117,9 @@ static int __cmd_report(void)
} }
if (thread == NULL) { if (thread == NULL) {
fprintf(stderr, "problem processing %d event, bailing out\n", fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type); event->header.type);
goto done; goto broken_event;
} }
if (event->header.misc & PERF_EVENT_MISC_KERNEL) { if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
...@@ -1149,8 +1149,8 @@ static int __cmd_report(void) ...@@ -1149,8 +1149,8 @@ static int __cmd_report(void)
if (hist_entry__add(thread, map, dso, sym, ip, level)) { if (hist_entry__add(thread, map, dso, sym, ip, level)) {
fprintf(stderr, fprintf(stderr,
"problem incrementing symbol count, bailing out\n"); "problem incrementing symbol count, skipping event\n");
goto done; goto broken_event;
} }
} }
total++; total++;
...@@ -1169,8 +1169,8 @@ static int __cmd_report(void) ...@@ -1169,8 +1169,8 @@ static int __cmd_report(void)
event->mmap.filename); event->mmap.filename);
} }
if (thread == NULL || map == NULL) { if (thread == NULL || map == NULL) {
fprintf(stderr, "problem processing PERF_EVENT_MMAP, bailing out\n"); fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
goto done; goto broken_event;
} }
thread__insert_map(thread, map); thread__insert_map(thread, map);
total_mmap++; total_mmap++;
...@@ -1187,8 +1187,8 @@ static int __cmd_report(void) ...@@ -1187,8 +1187,8 @@ static int __cmd_report(void)
} }
if (thread == NULL || if (thread == NULL ||
thread__set_comm(thread, event->comm.comm)) { thread__set_comm(thread, event->comm.comm)) {
fprintf(stderr, "problem processing PERF_EVENT_COMM, bailing out\n"); fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
goto done; goto broken_event;
} }
total_comm++; total_comm++;
break; break;
...@@ -1221,7 +1221,6 @@ static int __cmd_report(void) ...@@ -1221,7 +1221,6 @@ static int __cmd_report(void)
goto more; goto more;
rc = EXIT_SUCCESS; rc = EXIT_SUCCESS;
done:
close(input); close(input);
if (dump_trace) { if (dump_trace) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment