Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147621
b: refs/heads/master
c: 3502973
h: refs/heads/master
i:
  147619: b24cd35
v: v3
  • Loading branch information
Ingo Molnar committed Jun 3, 2009
1 parent 52c5082 commit 4474f4c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ce998d6693bd02ab3b74ee1cc303ecb1fa9b514
refs/heads/master: 3502973d005ed89cc2b3f39780813a341ddba97f
64 changes: 30 additions & 34 deletions trunk/Documentation/perf_counter/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -729,14 +731,12 @@ static int __cmd_report(void)
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",
Expand Down Expand Up @@ -781,15 +781,14 @@ static int __cmd_report(void)
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");
Expand All @@ -802,12 +801,11 @@ static int __cmd_report(void)
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");
Expand All @@ -818,11 +816,10 @@ static int __cmd_report(void)
}
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++;

Expand All @@ -846,14 +843,13 @@ static int __cmd_report(void)
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);

if (dump_trace)
return 0;
}

if (verbose >= 2)
dsos__fprintf(stdout);
Expand Down

0 comments on commit 4474f4c

Please sign in to comment.