diff options
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 7021dc1b0ca6..0302405aa2ca 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -48,6 +48,11 @@ static unsigned long long input_buf_siz; | |||
48 | 48 | ||
49 | static int cpus; | 49 | static int cpus; |
50 | static int long_size; | 50 | static int long_size; |
51 | static int is_flag_field; | ||
52 | static int is_symbolic_field; | ||
53 | |||
54 | static struct format_field * | ||
55 | find_any_field(struct event *event, const char *name); | ||
51 | 56 | ||
52 | static void init_input_buf(char *buf, unsigned long long size) | 57 | static void init_input_buf(char *buf, unsigned long long size) |
53 | { | 58 | { |
@@ -1301,6 +1306,16 @@ process_entry(struct event *event __unused, struct print_arg *arg, | |||
1301 | arg->type = PRINT_FIELD; | 1306 | arg->type = PRINT_FIELD; |
1302 | arg->field.name = field; | 1307 | arg->field.name = field; |
1303 | 1308 | ||
1309 | if (is_flag_field) { | ||
1310 | arg->field.field = find_any_field(event, arg->field.name); | ||
1311 | arg->field.field->flags |= FIELD_IS_FLAG; | ||
1312 | is_flag_field = 0; | ||
1313 | } else if (is_symbolic_field) { | ||
1314 | arg->field.field = find_any_field(event, arg->field.name); | ||
1315 | arg->field.field->flags |= FIELD_IS_SYMBOLIC; | ||
1316 | is_symbolic_field = 0; | ||
1317 | } | ||
1318 | |||
1304 | type = read_token(&token); | 1319 | type = read_token(&token); |
1305 | *tok = token; | 1320 | *tok = token; |
1306 | 1321 | ||
@@ -1668,9 +1683,11 @@ process_arg_token(struct event *event, struct print_arg *arg, | |||
1668 | type = process_entry(event, arg, &token); | 1683 | type = process_entry(event, arg, &token); |
1669 | } else if (strcmp(token, "__print_flags") == 0) { | 1684 | } else if (strcmp(token, "__print_flags") == 0) { |
1670 | free_token(token); | 1685 | free_token(token); |
1686 | is_flag_field = 1; | ||
1671 | type = process_flags(event, arg, &token); | 1687 | type = process_flags(event, arg, &token); |
1672 | } else if (strcmp(token, "__print_symbolic") == 0) { | 1688 | } else if (strcmp(token, "__print_symbolic") == 0) { |
1673 | free_token(token); | 1689 | free_token(token); |
1690 | is_symbolic_field = 1; | ||
1674 | type = process_symbols(event, arg, &token); | 1691 | type = process_symbols(event, arg, &token); |
1675 | } else if (strcmp(token, "__get_str") == 0) { | 1692 | } else if (strcmp(token, "__get_str") == 0) { |
1676 | free_token(token); | 1693 | free_token(token); |
@@ -1871,7 +1888,7 @@ find_any_field(struct event *event, const char *name) | |||
1871 | return find_field(event, name); | 1888 | return find_field(event, name); |
1872 | } | 1889 | } |
1873 | 1890 | ||
1874 | static unsigned long long read_size(void *ptr, int size) | 1891 | unsigned long long read_size(void *ptr, int size) |
1875 | { | 1892 | { |
1876 | switch (size) { | 1893 | switch (size) { |
1877 | case 1: | 1894 | case 1: |
@@ -1956,7 +1973,7 @@ int trace_parse_common_type(void *data) | |||
1956 | "common_type"); | 1973 | "common_type"); |
1957 | } | 1974 | } |
1958 | 1975 | ||
1959 | static int parse_common_pid(void *data) | 1976 | int trace_parse_common_pid(void *data) |
1960 | { | 1977 | { |
1961 | static int pid_offset; | 1978 | static int pid_offset; |
1962 | static int pid_size; | 1979 | static int pid_size; |
@@ -1965,7 +1982,7 @@ static int parse_common_pid(void *data) | |||
1965 | "common_pid"); | 1982 | "common_pid"); |
1966 | } | 1983 | } |
1967 | 1984 | ||
1968 | static int parse_common_pc(void *data) | 1985 | int parse_common_pc(void *data) |
1969 | { | 1986 | { |
1970 | static int pc_offset; | 1987 | static int pc_offset; |
1971 | static int pc_size; | 1988 | static int pc_size; |
@@ -1974,7 +1991,7 @@ static int parse_common_pc(void *data) | |||
1974 | "common_preempt_count"); | 1991 | "common_preempt_count"); |
1975 | } | 1992 | } |
1976 | 1993 | ||
1977 | static int parse_common_flags(void *data) | 1994 | int parse_common_flags(void *data) |
1978 | { | 1995 | { |
1979 | static int flags_offset; | 1996 | static int flags_offset; |
1980 | static int flags_size; | 1997 | static int flags_size; |
@@ -1983,7 +2000,7 @@ static int parse_common_flags(void *data) | |||
1983 | "common_flags"); | 2000 | "common_flags"); |
1984 | } | 2001 | } |
1985 | 2002 | ||
1986 | static int parse_common_lock_depth(void *data) | 2003 | int parse_common_lock_depth(void *data) |
1987 | { | 2004 | { |
1988 | static int ld_offset; | 2005 | static int ld_offset; |
1989 | static int ld_size; | 2006 | static int ld_size; |
@@ -2008,6 +2025,14 @@ struct event *trace_find_event(int id) | |||
2008 | return event; | 2025 | return event; |
2009 | } | 2026 | } |
2010 | 2027 | ||
2028 | struct event *trace_find_next_event(struct event *event) | ||
2029 | { | ||
2030 | if (!event) | ||
2031 | return event_list; | ||
2032 | |||
2033 | return event->next; | ||
2034 | } | ||
2035 | |||
2011 | static unsigned long long eval_num_arg(void *data, int size, | 2036 | static unsigned long long eval_num_arg(void *data, int size, |
2012 | struct event *event, struct print_arg *arg) | 2037 | struct event *event, struct print_arg *arg) |
2013 | { | 2038 | { |
@@ -2147,7 +2172,7 @@ static const struct flag flags[] = { | |||
2147 | { "HRTIMER_RESTART", 1 }, | 2172 | { "HRTIMER_RESTART", 1 }, |
2148 | }; | 2173 | }; |
2149 | 2174 | ||
2150 | static unsigned long long eval_flag(const char *flag) | 2175 | unsigned long long eval_flag(const char *flag) |
2151 | { | 2176 | { |
2152 | int i; | 2177 | int i; |
2153 | 2178 | ||
@@ -2677,7 +2702,7 @@ get_return_for_leaf(int cpu, int cur_pid, unsigned long long cur_func, | |||
2677 | if (!(event->flags & EVENT_FL_ISFUNCRET)) | 2702 | if (!(event->flags & EVENT_FL_ISFUNCRET)) |
2678 | return NULL; | 2703 | return NULL; |
2679 | 2704 | ||
2680 | pid = parse_common_pid(next->data); | 2705 | pid = trace_parse_common_pid(next->data); |
2681 | field = find_field(event, "func"); | 2706 | field = find_field(event, "func"); |
2682 | if (!field) | 2707 | if (!field) |
2683 | die("function return does not have field func"); | 2708 | die("function return does not have field func"); |
@@ -2963,7 +2988,7 @@ void print_event(int cpu, void *data, int size, unsigned long long nsecs, | |||
2963 | return; | 2988 | return; |
2964 | } | 2989 | } |
2965 | 2990 | ||
2966 | pid = parse_common_pid(data); | 2991 | pid = trace_parse_common_pid(data); |
2967 | 2992 | ||
2968 | if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET)) | 2993 | if (event->flags & (EVENT_FL_ISFUNCENT | EVENT_FL_ISFUNCRET)) |
2969 | return pretty_print_func_graph(data, size, event, cpu, | 2994 | return pretty_print_func_graph(data, size, event, cpu, |