From b48285980de2070948c8ac73629c605ad9202589 Mon Sep 17 00:00:00 2001 From: Vaibhav Nagarnaik Date: Fri, 6 Apr 2012 00:48:03 +0200 Subject: [PATCH] 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 Cc: David Sharp Signed-off-by: Vaibhav Nagarnaik Link: http://lkml.kernel.org/r/1310785241-3799-4-git-send-email-vnagarnaik@google.com Signed-off-by: Steven Rostedt Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Steven Rostedt Cc: Borislav Petkov Cc: Jiri Olsa Cc: Arun Sharma Cc: Namhyung Kim Signed-off-by: Frederic Weisbecker --- tools/lib/traceevent/event-parse.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 4d5092f67167..476626af7317 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; -- 2.39.5