Commit f49515b1 authored by Ingo Molnar's avatar Ingo Molnar

perf report: add more debugging

Add the offset of the file we are analyzing, and the size of the record.

In case of problems it's easier to see where the parser lost track.

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>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3e706114
...@@ -645,7 +645,7 @@ static int __cmd_report(void) ...@@ -645,7 +645,7 @@ static int __cmd_report(void)
char *buf; char *buf;
event_t *event; event_t *event;
int ret, rc = EXIT_FAILURE; int ret, rc = EXIT_FAILURE;
unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown; unsigned long total = 0, total_mmap = 0, total_comm = 0, total_unknown = 0;
input = open(input_name, O_RDONLY); input = open(input_name, O_RDONLY);
if (input < 0) { if (input < 0) {
...@@ -699,8 +699,6 @@ static int __cmd_report(void) ...@@ -699,8 +699,6 @@ static int __cmd_report(void)
goto done; goto done;
} }
head += event->header.size;
if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) { if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
char level; char level;
int show = 0; int show = 0;
...@@ -709,7 +707,9 @@ static int __cmd_report(void) ...@@ -709,7 +707,9 @@ static int __cmd_report(void)
uint64_t ip = event->ip.ip; uint64_t ip = event->ip.ip;
if (dump_trace) { if (dump_trace) {
fprintf(stderr, "PERF_EVENT (IP, %d): %d: %p\n", fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->header.misc, event->header.misc,
event->ip.pid, event->ip.pid,
(void *)event->ip.ip); (void *)event->ip.ip);
...@@ -753,7 +753,9 @@ static int __cmd_report(void) ...@@ -753,7 +753,9 @@ static int __cmd_report(void)
struct map *map = map__new(&event->mmap); struct map *map = map__new(&event->mmap);
if (dump_trace) { if (dump_trace) {
fprintf(stderr, "PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n", fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
(void *)event->mmap.start, (void *)event->mmap.start,
(void *)event->mmap.len, (void *)event->mmap.len,
(void *)event->mmap.pgoff, (void *)event->mmap.pgoff,
...@@ -771,7 +773,9 @@ static int __cmd_report(void) ...@@ -771,7 +773,9 @@ static int __cmd_report(void)
struct thread *thread = threads__findnew(event->comm.pid); struct thread *thread = threads__findnew(event->comm.pid);
if (dump_trace) { if (dump_trace) {
fprintf(stderr, "PERF_EVENT_COMM: %s:%d\n", fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->comm.comm, event->comm.pid); event->comm.comm, event->comm.pid);
} }
if (thread == NULL || if (thread == NULL ||
...@@ -783,12 +787,16 @@ static int __cmd_report(void) ...@@ -783,12 +787,16 @@ static int __cmd_report(void)
break; break;
} }
default: { default: {
fprintf(stderr, "skipping unknown header type: %d\n", fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
(void *)(offset + head),
(void *)(long)(event->header.size),
event->header.type); event->header.type);
total_unknown++; total_unknown++;
} }
} }
head += event->header.size;
if (offset + head < stat.st_size) if (offset + head < stat.st_size)
goto more; goto more;
......
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