[tip:perf/core] tools lib traceevent: Implement '%' operation
From: tip-bot for Daniel Bristot de Oliveira
Date: Thu Feb 25 2016 - 01:30:22 EST
Commit-ID: 0e47b38dcd24c78d0699b42f28d5986154d2aa11
Gitweb: http://git.kernel.org/tip/0e47b38dcd24c78d0699b42f28d5986154d2aa11
Author: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
AuthorDate: Mon, 22 Feb 2016 14:08:22 -0300
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitDate: Tue, 23 Feb 2016 11:40:51 -0300
tools lib traceevent: Implement '%' operation
The operation '%' is not implemented on event-parse.c, causing an error
when parsing events with '%' the operation in its printk format. For
example,
# perf record -e sched:sched_deadline_yield ~/yield-test
Warning: [sched:sched_deadline_yield] unknown op '%'
....
# perf script
Warning: [sched:sched_deadline_yield] unknown op '%'
test 1641 [006] 3364.109319: sched:sched_deadline_yield: \
[FAILED TO PARSE] now=3364109314595 \
deadline=3364139295135 runtime=19975597
This patch implements the '%' operation. With this patch, we see the
correct output:
# perf record -e sched:sched_deadline_yield ~/yield-test
No Warning
# perf script
yield-test 4005 [001] 4623.650978: sched:sched_deadline_yield: \
now=4623.650974050 \
deadline=4623.680957364 remaining_runtime=19979611
Signed-off-by: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
Reviewed-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-rt-users <linux-rt-users@xxxxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/5c96a395c56cea6d3d13d949051bdece86cc26e0.1456157869.git.bristot@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/lib/traceevent/event-parse.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index c3bd294..575e751 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -1951,6 +1951,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
strcmp(token, "*") == 0 ||
strcmp(token, "^") == 0 ||
strcmp(token, "/") == 0 ||
+ strcmp(token, "%") == 0 ||
strcmp(token, "<") == 0 ||
strcmp(token, ">") == 0 ||
strcmp(token, "<=") == 0 ||
@@ -3689,6 +3690,9 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
case '/':
val = left / right;
break;
+ case '%':
+ val = left % right;
+ break;
case '*':
val = left * right;
break;