diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
commit | 4d7b4ac22fbec1a03206c6cde353f2fd6942f828 (patch) | |
tree | 2d96a9e9c28cf6fa628a278decc00ad55a8b043b /tools/perf/util/parse-events.c | |
parent | 3aaf51ace5975050ab43c7d4d7e439e0ae7d13d7 (diff) | |
parent | 94f3ca95787ada3d64339a4ecb2754236ab563f6 (diff) |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
perf tools: Add mode to build without newt support
perf symbols: symbol inconsistency message should be done only at verbose=1
perf tui: Add explicit -lslang option
perf options: Type check all the remaining OPT_ variants
perf options: Type check OPT_BOOLEAN and fix the offenders
perf options: Check v type in OPT_U?INTEGER
perf options: Introduce OPT_UINTEGER
perf tui: Add workaround for slang < 2.1.4
perf record: Fix bug mismatch with -c option definition
perf options: Introduce OPT_U64
perf tui: Add help window to show key associations
perf tui: Make <- exit menus too
perf newt: Add single key shortcuts for zoom into DSO and threads
perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
perf newt: Fix the 'A'/'a' shortcut for annotate
perf newt: Make <- exit the ui_browser
x86, perf: P4 PMU - fix counters management logic
perf newt: Make <- zoom out filters
perf report: Report number of events, not samples
perf hist: Clarify events_stats fields usage
...
Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 05d0c5c2030c..9bf0f402ca73 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include "parse-events.h" | 5 | #include "parse-events.h" |
6 | #include "exec_cmd.h" | 6 | #include "exec_cmd.h" |
7 | #include "string.h" | 7 | #include "string.h" |
8 | #include "symbol.h" | ||
8 | #include "cache.h" | 9 | #include "cache.h" |
9 | #include "header.h" | 10 | #include "header.h" |
10 | #include "debugfs.h" | 11 | #include "debugfs.h" |
@@ -409,7 +410,6 @@ static enum event_result | |||
409 | parse_single_tracepoint_event(char *sys_name, | 410 | parse_single_tracepoint_event(char *sys_name, |
410 | const char *evt_name, | 411 | const char *evt_name, |
411 | unsigned int evt_length, | 412 | unsigned int evt_length, |
412 | char *flags, | ||
413 | struct perf_event_attr *attr, | 413 | struct perf_event_attr *attr, |
414 | const char **strp) | 414 | const char **strp) |
415 | { | 415 | { |
@@ -418,14 +418,6 @@ parse_single_tracepoint_event(char *sys_name, | |||
418 | u64 id; | 418 | u64 id; |
419 | int fd; | 419 | int fd; |
420 | 420 | ||
421 | if (flags) { | ||
422 | if (!strncmp(flags, "record", strlen(flags))) { | ||
423 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
424 | attr->sample_type |= PERF_SAMPLE_TIME; | ||
425 | attr->sample_type |= PERF_SAMPLE_CPU; | ||
426 | } | ||
427 | } | ||
428 | |||
429 | snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path, | 421 | snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path, |
430 | sys_name, evt_name); | 422 | sys_name, evt_name); |
431 | 423 | ||
@@ -444,6 +436,13 @@ parse_single_tracepoint_event(char *sys_name, | |||
444 | attr->type = PERF_TYPE_TRACEPOINT; | 436 | attr->type = PERF_TYPE_TRACEPOINT; |
445 | *strp = evt_name + evt_length; | 437 | *strp = evt_name + evt_length; |
446 | 438 | ||
439 | attr->sample_type |= PERF_SAMPLE_RAW; | ||
440 | attr->sample_type |= PERF_SAMPLE_TIME; | ||
441 | attr->sample_type |= PERF_SAMPLE_CPU; | ||
442 | |||
443 | attr->sample_period = 1; | ||
444 | |||
445 | |||
447 | return EVT_HANDLED; | 446 | return EVT_HANDLED; |
448 | } | 447 | } |
449 | 448 | ||
@@ -532,8 +531,7 @@ static enum event_result parse_tracepoint_event(const char **strp, | |||
532 | flags); | 531 | flags); |
533 | } else | 532 | } else |
534 | return parse_single_tracepoint_event(sys_name, evt_name, | 533 | return parse_single_tracepoint_event(sys_name, evt_name, |
535 | evt_length, flags, | 534 | evt_length, attr, strp); |
536 | attr, strp); | ||
537 | } | 535 | } |
538 | 536 | ||
539 | static enum event_result | 537 | static enum event_result |
@@ -690,19 +688,29 @@ static enum event_result | |||
690 | parse_event_modifier(const char **strp, struct perf_event_attr *attr) | 688 | parse_event_modifier(const char **strp, struct perf_event_attr *attr) |
691 | { | 689 | { |
692 | const char *str = *strp; | 690 | const char *str = *strp; |
693 | int eu = 1, ek = 1, eh = 1; | 691 | int exclude = 0; |
692 | int eu = 0, ek = 0, eh = 0, precise = 0; | ||
694 | 693 | ||
695 | if (*str++ != ':') | 694 | if (*str++ != ':') |
696 | return 0; | 695 | return 0; |
697 | while (*str) { | 696 | while (*str) { |
698 | if (*str == 'u') | 697 | if (*str == 'u') { |
698 | if (!exclude) | ||
699 | exclude = eu = ek = eh = 1; | ||
699 | eu = 0; | 700 | eu = 0; |
700 | else if (*str == 'k') | 701 | } else if (*str == 'k') { |
702 | if (!exclude) | ||
703 | exclude = eu = ek = eh = 1; | ||
701 | ek = 0; | 704 | ek = 0; |
702 | else if (*str == 'h') | 705 | } else if (*str == 'h') { |
706 | if (!exclude) | ||
707 | exclude = eu = ek = eh = 1; | ||
703 | eh = 0; | 708 | eh = 0; |
704 | else | 709 | } else if (*str == 'p') { |
710 | precise++; | ||
711 | } else | ||
705 | break; | 712 | break; |
713 | |||
706 | ++str; | 714 | ++str; |
707 | } | 715 | } |
708 | if (str >= *strp + 2) { | 716 | if (str >= *strp + 2) { |
@@ -710,6 +718,7 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr) | |||
710 | attr->exclude_user = eu; | 718 | attr->exclude_user = eu; |
711 | attr->exclude_kernel = ek; | 719 | attr->exclude_kernel = ek; |
712 | attr->exclude_hv = eh; | 720 | attr->exclude_hv = eh; |
721 | attr->precise_ip = precise; | ||
713 | return 1; | 722 | return 1; |
714 | } | 723 | } |
715 | return 0; | 724 | return 0; |
@@ -934,7 +943,8 @@ void print_events(void) | |||
934 | 943 | ||
935 | printf("\n"); | 944 | printf("\n"); |
936 | printf(" %-42s [%s]\n", | 945 | printf(" %-42s [%s]\n", |
937 | "rNNN", event_type_descriptors[PERF_TYPE_RAW]); | 946 | "rNNN (see 'perf list --help' on how to encode it)", |
947 | event_type_descriptors[PERF_TYPE_RAW]); | ||
938 | printf("\n"); | 948 | printf("\n"); |
939 | 949 | ||
940 | printf(" %-42s [%s]\n", | 950 | printf(" %-42s [%s]\n", |