diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2011-09-04 11:08:59 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-02-17 13:34:08 -0500 |
commit | a5a178e1ae0192e405830f1bba84548992124e88 (patch) | |
tree | 0befc4ea59e523ba47d0f1b4ca2732bef64072e9 /tools | |
parent | 09bda4432a8a4d4db2b2b94697abc8d732a9ff73 (diff) |
perf tools: Allow expressions in __print_symbolic() fields
The __print_symbolic() function takes a sequence of key-value pairs for
pretty-printing a constant. The new kvm:kvm_exit print fmt uses the
expression:
__print_symbolic(..., { 0x040 + 1, "DB excp" }, ...)
Currently only atoms are supported and this print fmt fails to parse.
This patch adds support for expressions instead of just atoms so that
0x040 + 1 is parsed successfully. Also add arg_num_eval() support for
the '+' operator.
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1315148939-14313-1-git-send-email-stefanha@linux.vnet.ibm.com
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index e0a4f652f289..a4088ced1e64 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -1423,6 +1423,11 @@ static long long arg_num_eval(struct print_arg *arg) | |||
1423 | die("unknown op '%s'", arg->op.op); | 1423 | die("unknown op '%s'", arg->op.op); |
1424 | } | 1424 | } |
1425 | break; | 1425 | break; |
1426 | case '+': | ||
1427 | left = arg_num_eval(arg->op.left); | ||
1428 | right = arg_num_eval(arg->op.right); | ||
1429 | val = left + right; | ||
1430 | break; | ||
1426 | default: | 1431 | default: |
1427 | die("unknown op '%s'", arg->op.op); | 1432 | die("unknown op '%s'", arg->op.op); |
1428 | } | 1433 | } |
@@ -1483,6 +1488,13 @@ process_fields(struct event *event, struct print_flag_sym **list, char **tok) | |||
1483 | 1488 | ||
1484 | free_token(token); | 1489 | free_token(token); |
1485 | type = process_arg(event, arg, &token); | 1490 | type = process_arg(event, arg, &token); |
1491 | |||
1492 | if (type == EVENT_OP) | ||
1493 | type = process_op(event, arg, &token); | ||
1494 | |||
1495 | if (type == EVENT_ERROR) | ||
1496 | goto out_free; | ||
1497 | |||
1486 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1498 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
1487 | goto out_free; | 1499 | goto out_free; |
1488 | 1500 | ||