perf trace: Add flag/symbolic format_flags
authorTom Zanussi <tzanussi@gmail.com>
Wed, 25 Nov 2009 07:15:47 +0000 (01:15 -0600)
committerIngo Molnar <mingo@elte.hu>
Sat, 28 Nov 2009 09:04:25 +0000 (10:04 +0100)
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>
tools/perf/util/trace-event-parse.c
tools/perf/util/trace-event.h

index 7021dc1b0ca648981b89c716d87377d0e9a1cfbd..85d7163a9fd4456bf0943ac690f54f1a66a54e77 100644 (file)
@@ -48,6 +48,11 @@ static unsigned long long input_buf_siz;
 
 static int cpus;
 static int long_size;
+static int is_flag_field;
+static int is_symbolic_field;
+
+static struct format_field *
+find_any_field(struct event *event, const char *name);
 
 static void init_input_buf(char *buf, unsigned long long size)
 {
@@ -1301,6 +1306,16 @@ process_entry(struct event *event __unused, struct print_arg *arg,
        arg->type = PRINT_FIELD;
        arg->field.name = field;
 
+       if (is_flag_field) {
+               arg->field.field = find_any_field(event, arg->field.name);
+               arg->field.field->flags |= FIELD_IS_FLAG;
+               is_flag_field = 0;
+       } else if (is_symbolic_field) {
+               arg->field.field = find_any_field(event, arg->field.name);
+               arg->field.field->flags |= FIELD_IS_SYMBOLIC;
+               is_symbolic_field = 0;
+       }
+
        type = read_token(&token);
        *tok = token;
 
@@ -1668,9 +1683,11 @@ process_arg_token(struct event *event, struct print_arg *arg,
                        type = process_entry(event, arg, &token);
                } else if (strcmp(token, "__print_flags") == 0) {
                        free_token(token);
+                       is_flag_field = 1;
                        type = process_flags(event, arg, &token);
                } else if (strcmp(token, "__print_symbolic") == 0) {
                        free_token(token);
+                       is_symbolic_field = 1;
                        type = process_symbols(event, arg, &token);
                } else if (strcmp(token, "__get_str") == 0) {
                        free_token(token);
index e7aaf002e6679ec5599cfa6a39a09f3f6dbf7020..aeb915778ae7c13f61086e92d6e1d4710a7d5236 100644 (file)
@@ -29,6 +29,8 @@ enum format_flags {
        FIELD_IS_SIGNED         = 4,
        FIELD_IS_STRING         = 8,
        FIELD_IS_DYNAMIC        = 16,
+       FIELD_IS_FLAG           = 32,
+       FIELD_IS_SYMBOLIC       = 64,
 };
 
 struct format_field {