diff options
author | Tom Zanussi <tzanussi@gmail.com> | 2009-11-25 02:15:47 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-28 04:04:25 -0500 |
commit | eb9a42caa7a926beb935a22bc59d981b35f0b652 (patch) | |
tree | d546fbd988180882659515d586511f896809abec /tools/perf/util/trace-event-parse.c | |
parent | 956ffd027bedc4106b901eb6a50f0a6c6de4113d (diff) |
perf trace: Add flag/symbolic format_flags
It's useful to know whether a field is a flag or symbolic field
for e.g. when generating scripts - it allows us to translate
those fields specially rather than literally as plain numeric
values.
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Cc: fweisbec@gmail.com
Cc: rostedt@goodmis.org
Cc: anton@samba.org
Cc: hch@infradead.org
LKML-Reference: <1259133352-23685-3-git-send-email-tzanussi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 7021dc1b0ca6..85d7163a9fd4 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); |