aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/perf-report.cc
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-05 11:50:27 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-05 14:18:33 -0400
commit16c8a10932aef971292c9570eb5f60b5d4e83ed2 (patch)
treeee9f6860cad353bb7a5219468ffdc4e4fc700792 /Documentation/perf_counter/perf-report.cc
parent2023b359214bbc5bad31571cf50d7fb83b535c0a (diff)
perf_counter: tools: update the tools to support process and inherited counters
"perf record": - per task counter - inherit switch - nmi switch "perf report": - userspace/kernel filter "perf stat": - userspace/kernel filter Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> LKML-Reference: <20090505155437.389163017@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/perf-report.cc')
-rw-r--r--Documentation/perf_counter/perf-report.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/Documentation/perf_counter/perf-report.cc b/Documentation/perf_counter/perf-report.cc
index 911d7f3e7a65..8855107fe6b3 100644
--- a/Documentation/perf_counter/perf-report.cc
+++ b/Documentation/perf_counter/perf-report.cc
@@ -33,8 +33,13 @@
33#include <string> 33#include <string>
34 34
35 35
36#define SHOW_KERNEL 1
37#define SHOW_USER 2
38#define SHOW_HV 4
39
36static char const *input_name = "output.perf"; 40static char const *input_name = "output.perf";
37static int input; 41static int input;
42static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV;
38 43
39static unsigned long page_size; 44static unsigned long page_size;
40static unsigned long mmap_window = 32; 45static unsigned long mmap_window = 32;
@@ -359,15 +364,21 @@ static void process_options(int argc, char *argv[])
359 /** Options for getopt */ 364 /** Options for getopt */
360 static struct option long_options[] = { 365 static struct option long_options[] = {
361 {"input", required_argument, NULL, 'i'}, 366 {"input", required_argument, NULL, 'i'},
367 {"no-user", no_argument, NULL, 'u'},
368 {"no-kernel", no_argument, NULL, 'k'},
369 {"no-hv", no_argument, NULL, 'h'},
362 {NULL, 0, NULL, 0 } 370 {NULL, 0, NULL, 0 }
363 }; 371 };
364 int c = getopt_long(argc, argv, "+:i:", 372 int c = getopt_long(argc, argv, "+:i:kuh",
365 long_options, &option_index); 373 long_options, &option_index);
366 if (c == -1) 374 if (c == -1)
367 break; 375 break;
368 376
369 switch (c) { 377 switch (c) {
370 case 'i': input_name = strdup(optarg); break; 378 case 'i': input_name = strdup(optarg); break;
379 case 'k': show_mask &= ~SHOW_KERNEL; break;
380 case 'u': show_mask &= ~SHOW_USER; break;
381 case 'h': show_mask &= ~SHOW_HV; break;
371 default: error = 1; break; 382 default: error = 1; break;
372 } 383 }
373 } 384 }
@@ -443,22 +454,28 @@ more:
443 454
444 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) { 455 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
445 std::string comm, sym, level; 456 std::string comm, sym, level;
457 int show = 0;
446 char output[1024]; 458 char output[1024];
447 459
448 if (event->header.misc & PERF_EVENT_MISC_KERNEL) { 460 if (event->header.misc & PERF_EVENT_MISC_KERNEL) {
461 show |= SHOW_KERNEL;
449 level = " [k] "; 462 level = " [k] ";
450 sym = resolve_kernel_symbol(event->ip.ip); 463 sym = resolve_kernel_symbol(event->ip.ip);
451 } else if (event->header.misc & PERF_EVENT_MISC_USER) { 464 } else if (event->header.misc & PERF_EVENT_MISC_USER) {
465 show |= SHOW_USER;
452 level = " [.] "; 466 level = " [.] ";
453 sym = resolve_user_symbol(event->ip.pid, event->ip.ip); 467 sym = resolve_user_symbol(event->ip.pid, event->ip.ip);
454 } else { 468 } else {
469 show |= SHOW_HV;
455 level = " [H] "; 470 level = " [H] ";
456 } 471 }
457 comm = resolve_comm(event->ip.pid);
458 472
459 snprintf(output, sizeof(output), "%16s %s %s", 473 if (show & show_mask) {
460 comm.c_str(), level.c_str(), sym.c_str()); 474 comm = resolve_comm(event->ip.pid);
461 hist[output]++; 475 snprintf(output, sizeof(output), "%16s %s %s",
476 comm.c_str(), level.c_str(), sym.c_str());
477 hist[output]++;
478 }
462 479
463 total++; 480 total++;
464 481