aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/parse-events.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-05-17 22:26:53 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-18 00:35:23 -0400
commitf0218b3e9974f06014b61be8987159f4a20e011e (patch)
tree29a593c4d71ab18cb0c450a34e79bf6bea66877e /tools/perf/util/parse-events.c
parent1eaa4787a774c4896518c81f24e8bccaa2244924 (diff)
parent9d192e118a094087494997ea1c8a2faf39af38c5 (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip into trace/tip/tracing/core-6
Conflicts: include/trace/ftrace.h kernel/trace/trace_kprobe.c Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r--tools/perf/util/parse-events.c44
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
409parse_single_tracepoint_event(char *sys_name, 410parse_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
539static enum event_result 537static enum event_result
@@ -690,19 +688,29 @@ static enum event_result
690parse_event_modifier(const char **strp, struct perf_event_attr *attr) 688parse_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",