[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-97dd543cbd39f762357ba6cd5bfd94771851c96b@git.kernel.org>
Date: Wed, 3 Jun 2009 08:46:32 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org,
hpa@...or.com, mingo@...hat.com, jkacur@...hat.com,
a.p.zijlstra@...llo.nl, efault@....de, mtosatti@...hat.com,
tglx@...utronix.de, cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf report: Print -D to stdout
Commit-ID: 97dd543cbd39f762357ba6cd5bfd94771851c96b
Gitweb: http://git.kernel.org/tip/97dd543cbd39f762357ba6cd5bfd94771851c96b
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Wed, 3 Jun 2009 09:38:58 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Wed, 3 Jun 2009 09:38:58 +0200
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@...llo.nl>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: John Kacur <jkacur@...hat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
Documentation/perf_counter/builtin-report.c | 65 ++++++++++++--------------
1 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 9da990f..2c8034f 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -31,6 +31,8 @@ static int input;
static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
static int dump_trace = 0;
+#define dprintf(x...) do { if (dump_trace) printf(x); } while (0)
+
static int verbose;
static int full_paths;
@@ -729,14 +731,12 @@ more:
uint64_t ip = event->ip.ip;
struct map *map = NULL;
- if (dump_trace) {
- fprintf(stderr, "%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
- (void *)(offset + head),
- (void *)(long)(event->header.size),
- event->header.misc,
- event->ip.pid,
- (void *)(long)ip);
- }
+ dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event->header.misc,
+ event->ip.pid,
+ (void *)(long)ip);
if (thread == NULL) {
fprintf(stderr, "problem processing %d event, skipping it.\n",
@@ -781,15 +781,14 @@ more:
struct thread *thread = threads__findnew(event->mmap.pid);
struct map *map = map__new(&event->mmap, cwdp, cwdlen);
- if (dump_trace) {
- fprintf(stderr, "%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
- (void *)(offset + head),
- (void *)(long)(event->header.size),
- (void *)(long)event->mmap.start,
- (void *)(long)event->mmap.len,
- (void *)(long)event->mmap.pgoff,
- event->mmap.filename);
- }
+ dprintf("%p [%p]: PERF_EVENT_MMAP: [%p(%p) @ %p]: %s\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ (void *)(long)event->mmap.start,
+ (void *)(long)event->mmap.len,
+ (void *)(long)event->mmap.pgoff,
+ event->mmap.filename);
+
if (thread == NULL || map == NULL) {
if (verbose)
fprintf(stderr, "problem processing PERF_EVENT_MMAP, skipping event.\n");
@@ -802,12 +801,11 @@ more:
case PERF_EVENT_COMM: {
struct thread *thread = threads__findnew(event->comm.pid);
- if (dump_trace) {
- fprintf(stderr, "%p [%p]: PERF_EVENT_COMM: %s:%d\n",
- (void *)(offset + head),
- (void *)(long)(event->header.size),
- event->comm.comm, event->comm.pid);
- }
+ dprintf("%p [%p]: PERF_EVENT_COMM: %s:%d\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event->comm.comm, event->comm.pid);
+
if (thread == NULL ||
thread__set_comm(thread, event->comm.comm)) {
fprintf(stderr, "problem processing PERF_EVENT_COMM, skipping event.\n");
@@ -818,11 +816,10 @@ more:
}
default: {
broken_event:
- if (dump_trace)
- fprintf(stderr, "%p [%p]: skipping unknown header type: %d\n",
- (void *)(offset + head),
- (void *)(long)(event->header.size),
- event->header.type);
+ dprintf("%p [%p]: skipping unknown header type: %d\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event->header.type);
total_unknown++;
@@ -846,14 +843,12 @@ broken_event:
rc = EXIT_SUCCESS;
close(input);
- if (dump_trace) {
- fprintf(stderr, " IP events: %10ld\n", total);
- fprintf(stderr, " mmap events: %10ld\n", total_mmap);
- fprintf(stderr, " comm events: %10ld\n", total_comm);
- fprintf(stderr, " unknown events: %10ld\n", total_unknown);
+ dprintf(" IP events: %10ld\n", total);
+ dprintf(" mmap events: %10ld\n", total_mmap);
+ dprintf(" comm events: %10ld\n", total_comm);
+ dprintf(" unknown events: %10ld\n", total_unknown);
- return 0;
- }
+ return 0;
if (verbose >= 2)
dsos__fprintf(stdout);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists