[tip:perf/core] parse-events: Support '+' opcode in print format

From: tip-bot for Vaibhav Nagarnaik
Date: Mon May 21 2012 - 05:42:01 EST


Commit-ID: b48285980de2070948c8ac73629c605ad9202589
Gitweb: http://git.kernel.org/tip/b48285980de2070948c8ac73629c605ad9202589
Author: Vaibhav Nagarnaik <vnagarnaik@xxxxxxxxxx>
AuthorDate: Fri, 6 Apr 2012 00:48:03 +0200
Committer: Frederic Weisbecker <fweisbec@xxxxxxxxx>
CommitDate: Wed, 25 Apr 2012 13:35:38 +0200

parse-events: Support '+' opcode in print format

The '+' opcode is not supported in the arguments for the print format.
This patch adds support for it.

Cc: Michael Rubin <mrubin@xxxxxxxxxx>
Cc: David Sharp <dhsharp@xxxxxxxxxx>
Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/1310785241-3799-4-git-send-email-vnagarnaik@xxxxxxxxxx
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Arun Sharma <asharma@xxxxxx>
Cc: Namhyung Kim <namhyung.kim@xxxxxxx>
Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
tools/lib/traceevent/event-parse.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 4d5092f..476626a 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2047,6 +2047,18 @@ static int arg_num_eval(struct print_arg *arg, long long *val)
break;
*val = left - right;
break;
+ case '+':
+ if (arg->op.left->type == PRINT_NULL)
+ left = 0;
+ else
+ ret = arg_num_eval(arg->op.left, &left);
+ if (!ret)
+ break;
+ ret = arg_num_eval(arg->op.right, &right);
+ if (!ret)
+ break;
+ *val = left + right;
+ break;
default:
do_warning("unknown op '%s'", arg->op.op);
ret = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/