perf report: Print -D to stdout
-D prints to stderr - which is a bit confusing - print to stdout instead. Also clean up the if (dump_trace) patterns via a dprintf helper. 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: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
8ce998d669
commit
3502973d00
@ -31,6 +31,8 @@ static int input;
|
|||||||
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
|
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
|
||||||
|
|
||||||
static int dump_trace = 0;
|
static int dump_trace = 0;
|
||||||
|
#define dprintf(x...) do { if (dump_trace) printf(x); } while (0)
|
||||||
|
|
||||||
static int verbose;
|
static int verbose;
|
||||||
static int full_paths;
|
static int full_paths;
|
||||||
|
|
||||||
@ -729,14 +731,12 @@ static int __cmd_report(void)
|
|||||||
uint64_t ip = event->ip.ip;
|
uint64_t ip = event->ip.ip;
|
||||||
struct map *map = NULL;
|
struct map *map = NULL;
|
||||||
|
|
||||||
if (dump_trace) {
|
dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
|
||||||
fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
|
(void *)(offset + head),
|
||||||
(void *)(offset + head),
|
(void *)(long)(event->header.size),
|
||||||
(void *)(long)(event->header.size),
|
event->header.misc,
|
||||||
event->header.misc,
|
event->ip.pid,
|
||||||
event->ip.pid,
|
(void *)(long)ip);
|
||||||
(void *)(long)ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thread == NULL) {
|
if (thread == NULL) {
|
||||||
fprintf(stderr, "problem processing %d event, skipping it.\n",
|
fprintf(stderr, "problem processing %d event, skipping it.\n",
|
||||||
@ -781,15 +781,14 @@ static int __cmd_report(void)
|
|||||||
struct thread *thread = threads__findnew(event->mmap.pid);
|
struct thread *thread = threads__findnew(event->mmap.pid);
|
||||||
struct map *map = map__new(&event->mmap, cwdp, cwdlen);
|
struct map *map = map__new(&event->mmap, cwdp, cwdlen);
|
||||||
|
|
||||||
if (dump_trace) {
|
dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
|
||||||
fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
|
(void *)(offset + head),
|
||||||
(void *)(offset + head),
|
(void *)(long)(event->header.size),
|
||||||
(void *)(long)(event->header.size),
|
(void *)(long)event->mmap.start,
|
||||||
(void *)(long)event->mmap.start,
|
(void *)(long)event->mmap.len,
|
||||||
(void *)(long)event->mmap.len,
|
(void *)(long)event->mmap.pgoff,
|
||||||
(void *)(long)event->mmap.pgoff,
|
event->mmap.filename);
|
||||||
event->mmap.filename);
|
|
||||||
}
|
|
||||||
if (thread == NULL || map == NULL) {
|
if (thread == NULL || map == NULL) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
|
fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
|
||||||
@ -802,12 +801,11 @@ static int __cmd_report(void)
|
|||||||
case PERF_EVENT_COMM: {
|
case PERF_EVENT_COMM: {
|
||||||
struct thread *thread = threads__findnew(event->comm.pid);
|
struct thread *thread = threads__findnew(event->comm.pid);
|
||||||
|
|
||||||
if (dump_trace) {
|
dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
|
||||||
fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
|
(void *)(offset + head),
|
||||||
(void *)(offset + head),
|
(void *)(long)(event->header.size),
|
||||||
(void *)(long)(event->header.size),
|
event->comm.comm, event->comm.pid);
|
||||||
event->comm.comm, event->comm.pid);
|
|
||||||
}
|
|
||||||
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, skipping event.\n");
|
fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
|
||||||
@ -818,11 +816,10 @@ static int __cmd_report(void)
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
broken_event:
|
broken_event:
|
||||||
if (dump_trace)
|
dprintf("%p [%p]: skipping unknown header type: %d\n",
|
||||||
fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
|
(void *)(offset + head),
|
||||||
(void *)(offset + head),
|
(void *)(long)(event->header.size),
|
||||||
(void *)(long)(event->header.size),
|
event->header.type);
|
||||||
event->header.type);
|
|
||||||
|
|
||||||
total_unknown++;
|
total_unknown++;
|
||||||
|
|
||||||
@ -846,14 +843,13 @@ static int __cmd_report(void)
|
|||||||
rc = EXIT_SUCCESS;
|
rc = EXIT_SUCCESS;
|
||||||
close(input);
|
close(input);
|
||||||
|
|
||||||
if (dump_trace) {
|
dprintf(" IP events: %10ld\n", total);
|
||||||
fprintf(stderr, " IP events: %10ld\n", total);
|
dprintf(" mmap events: %10ld\n", total_mmap);
|
||||||
fprintf(stderr, " mmap events: %10ld\n", total_mmap);
|
dprintf(" comm events: %10ld\n", total_comm);
|
||||||
fprintf(stderr, " comm events: %10ld\n", total_comm);
|
dprintf(" unknown events: %10ld\n", total_unknown);
|
||||||
fprintf(stderr, " unknown events: %10ld\n", total_unknown);
|
|
||||||
|
|
||||||
|
if (dump_trace)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose >= 2)
|
if (verbose >= 2)
|
||||||
dsos__fprintf(stdout);
|
dsos__fprintf(stdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user