diff options
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 26 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 6 |
5 files changed, 24 insertions, 14 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8e2c85798185..80dc5b790e47 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -740,7 +740,7 @@ static bool force, append_file; | |||
740 | const struct option record_options[] = { | 740 | const struct option record_options[] = { |
741 | OPT_CALLBACK('e', "event", &evsel_list, "event", | 741 | OPT_CALLBACK('e', "event", &evsel_list, "event", |
742 | "event selector. use 'perf list' to list available events", | 742 | "event selector. use 'perf list' to list available events", |
743 | parse_events), | 743 | parse_events_option), |
744 | OPT_CALLBACK(0, "filter", &evsel_list, "filter", | 744 | OPT_CALLBACK(0, "filter", &evsel_list, "filter", |
745 | "event filter", parse_filter), | 745 | "event filter", parse_filter), |
746 | OPT_INTEGER('p', "pid", &target_pid, | 746 | OPT_INTEGER('p', "pid", &target_pid, |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 1d08c8084cc4..1ad04ce29c34 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -1032,7 +1032,7 @@ static int stat__set_big_num(const struct option *opt __used, | |||
1032 | static const struct option options[] = { | 1032 | static const struct option options[] = { |
1033 | OPT_CALLBACK('e', "event", &evsel_list, "event", | 1033 | OPT_CALLBACK('e', "event", &evsel_list, "event", |
1034 | "event selector. use 'perf list' to list available events", | 1034 | "event selector. use 'perf list' to list available events", |
1035 | parse_events), | 1035 | parse_events_option), |
1036 | OPT_CALLBACK(0, "filter", &evsel_list, "filter", | 1036 | OPT_CALLBACK(0, "filter", &evsel_list, "filter", |
1037 | "event filter", parse_filter), | 1037 | "event filter", parse_filter), |
1038 | OPT_BOOLEAN('i', "no-inherit", &no_inherit, | 1038 | OPT_BOOLEAN('i', "no-inherit", &no_inherit, |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index f2f3f4937aa2..a43433f08300 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -990,7 +990,7 @@ static const char * const top_usage[] = { | |||
990 | static const struct option options[] = { | 990 | static const struct option options[] = { |
991 | OPT_CALLBACK('e', "event", &top.evlist, "event", | 991 | OPT_CALLBACK('e', "event", &top.evlist, "event", |
992 | "event selector. use 'perf list' to list available events", | 992 | "event selector. use 'perf list' to list available events", |
993 | parse_events), | 993 | parse_events_option), |
994 | OPT_INTEGER('c', "count", &default_interval, | 994 | OPT_INTEGER('c', "count", &default_interval, |
995 | "event period to sample"), | 995 | "event period to sample"), |
996 | OPT_INTEGER('p', "pid", &top.target_pid, | 996 | OPT_INTEGER('p', "pid", &top.target_pid, |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index c0e21aec4896..4ea7e19f5251 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -478,7 +478,7 @@ parse_single_tracepoint_event(char *sys_name, | |||
478 | /* sys + ':' + event + ':' + flags*/ | 478 | /* sys + ':' + event + ':' + flags*/ |
479 | #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) | 479 | #define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) |
480 | static enum event_result | 480 | static enum event_result |
481 | parse_multiple_tracepoint_event(const struct option *opt, char *sys_name, | 481 | parse_multiple_tracepoint_event(struct perf_evlist *evlist, char *sys_name, |
482 | const char *evt_exp, char *flags) | 482 | const char *evt_exp, char *flags) |
483 | { | 483 | { |
484 | char evt_path[MAXPATHLEN]; | 484 | char evt_path[MAXPATHLEN]; |
@@ -512,7 +512,7 @@ parse_multiple_tracepoint_event(const struct option *opt, char *sys_name, | |||
512 | if (len < 0) | 512 | if (len < 0) |
513 | return EVT_FAILED; | 513 | return EVT_FAILED; |
514 | 514 | ||
515 | if (parse_events(opt, event_opt, 0)) | 515 | if (parse_events(evlist, event_opt, 0)) |
516 | return EVT_FAILED; | 516 | return EVT_FAILED; |
517 | } | 517 | } |
518 | 518 | ||
@@ -520,7 +520,7 @@ parse_multiple_tracepoint_event(const struct option *opt, char *sys_name, | |||
520 | } | 520 | } |
521 | 521 | ||
522 | static enum event_result | 522 | static enum event_result |
523 | parse_tracepoint_event(const struct option *opt, const char **strp, | 523 | parse_tracepoint_event(struct perf_evlist *evlist, const char **strp, |
524 | struct perf_event_attr *attr) | 524 | struct perf_event_attr *attr) |
525 | { | 525 | { |
526 | const char *evt_name; | 526 | const char *evt_name; |
@@ -560,8 +560,8 @@ parse_tracepoint_event(const struct option *opt, const char **strp, | |||
560 | return EVT_FAILED; | 560 | return EVT_FAILED; |
561 | if (strpbrk(evt_name, "*?")) { | 561 | if (strpbrk(evt_name, "*?")) { |
562 | *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */ | 562 | *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */ |
563 | return parse_multiple_tracepoint_event(opt, sys_name, evt_name, | 563 | return parse_multiple_tracepoint_event(evlist, sys_name, |
564 | flags); | 564 | evt_name, flags); |
565 | } else { | 565 | } else { |
566 | return parse_single_tracepoint_event(sys_name, evt_name, | 566 | return parse_single_tracepoint_event(sys_name, evt_name, |
567 | evt_length, attr, strp); | 567 | evt_length, attr, strp); |
@@ -781,12 +781,12 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr) | |||
781 | * Symbolic names are (almost) exactly matched. | 781 | * Symbolic names are (almost) exactly matched. |
782 | */ | 782 | */ |
783 | static enum event_result | 783 | static enum event_result |
784 | parse_event_symbols(const struct option *opt, const char **str, | 784 | parse_event_symbols(struct perf_evlist *evlist, const char **str, |
785 | struct perf_event_attr *attr) | 785 | struct perf_event_attr *attr) |
786 | { | 786 | { |
787 | enum event_result ret; | 787 | enum event_result ret; |
788 | 788 | ||
789 | ret = parse_tracepoint_event(opt, str, attr); | 789 | ret = parse_tracepoint_event(evlist, str, attr); |
790 | if (ret != EVT_FAILED) | 790 | if (ret != EVT_FAILED) |
791 | goto modifier; | 791 | goto modifier; |
792 | 792 | ||
@@ -825,9 +825,8 @@ modifier: | |||
825 | return ret; | 825 | return ret; |
826 | } | 826 | } |
827 | 827 | ||
828 | int parse_events(const struct option *opt, const char *str, int unset __used) | 828 | int parse_events(struct perf_evlist *evlist , const char *str, int unset __used) |
829 | { | 829 | { |
830 | struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; | ||
831 | struct perf_event_attr attr; | 830 | struct perf_event_attr attr; |
832 | enum event_result ret; | 831 | enum event_result ret; |
833 | const char *ostr; | 832 | const char *ostr; |
@@ -835,7 +834,7 @@ int parse_events(const struct option *opt, const char *str, int unset __used) | |||
835 | for (;;) { | 834 | for (;;) { |
836 | ostr = str; | 835 | ostr = str; |
837 | memset(&attr, 0, sizeof(attr)); | 836 | memset(&attr, 0, sizeof(attr)); |
838 | ret = parse_event_symbols(opt, &str, &attr); | 837 | ret = parse_event_symbols(evlist, &str, &attr); |
839 | if (ret == EVT_FAILED) | 838 | if (ret == EVT_FAILED) |
840 | return -1; | 839 | return -1; |
841 | 840 | ||
@@ -866,6 +865,13 @@ int parse_events(const struct option *opt, const char *str, int unset __used) | |||
866 | return 0; | 865 | return 0; |
867 | } | 866 | } |
868 | 867 | ||
868 | int parse_events_option(const struct option *opt, const char *str, | ||
869 | int unset __used) | ||
870 | { | ||
871 | struct perf_evlist *evlist = *(struct perf_evlist **)opt->value; | ||
872 | return parse_events(evlist, str, unset); | ||
873 | } | ||
874 | |||
869 | int parse_filter(const struct option *opt, const char *str, | 875 | int parse_filter(const struct option *opt, const char *str, |
870 | int unset __used) | 876 | int unset __used) |
871 | { | 877 | { |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 746d3fcbfc2a..2f8e375e038d 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | struct list_head; | 9 | struct list_head; |
10 | struct perf_evsel; | 10 | struct perf_evsel; |
11 | struct perf_evlist; | ||
11 | 12 | ||
12 | struct option; | 13 | struct option; |
13 | 14 | ||
@@ -24,7 +25,10 @@ const char *event_type(int type); | |||
24 | const char *event_name(struct perf_evsel *event); | 25 | const char *event_name(struct perf_evsel *event); |
25 | extern const char *__event_name(int type, u64 config); | 26 | extern const char *__event_name(int type, u64 config); |
26 | 27 | ||
27 | extern int parse_events(const struct option *opt, const char *str, int unset); | 28 | extern int parse_events_option(const struct option *opt, const char *str, |
29 | int unset); | ||
30 | extern int parse_events(struct perf_evlist *evlist, const char *str, | ||
31 | int unset); | ||
28 | extern int parse_filter(const struct option *opt, const char *str, int unset); | 32 | extern int parse_filter(const struct option *opt, const char *str, int unset); |
29 | 33 | ||
30 | #define EVENTS_HELP_MAX (128*1024) | 34 | #define EVENTS_HELP_MAX (128*1024) |