Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339739

[PATCH 4/4] tools lib traceevent: Implements '%' operation

From Daniel Bristot de Oliveira <bristot@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 4/4] tools lib traceevent: Implements '%' operation
Date 2016-02-22 18:10 +0100
Message-ID <r529J-AD-27@gated-at.bofh.it> (permalink)
References <r529I-AD-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The operation '%' is not implemented on event-parse.c, causing
an error on the parse of events with '%' operation on its
printk format. For example,

# perf record -e sched:sched_deadline_yield ~/y
  Warning: [sched:sched_deadline_yield] unknown op '%'
....
# perf script
  Warning: [sched:sched_deadline_yield] unknown op '%'
	y  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 ~/y
  No Warning

# perf script
	y  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@redhat.com>
---
 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;
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] Tracepoints for deadline scheduler Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-02-22 18:10 +0100
  [PATCH 4/4] tools lib traceevent: Implements '%' operation Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-02-22 18:10 +0100
    Re: [PATCH 4/4] tools lib traceevent: Implements '%' operation Steven Rostedt <rostedt@goodmis.org> - 2016-02-22 21:30 +0100
      Re: [PATCH 4/4] tools lib traceevent: Implements '%' operation Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-02-23 15:40 +0100
        Re: [PATCH 4/4] tools lib traceevent: Implements '%' operation Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-02-23 15:50 +0100
    [tip:perf/core] tools lib traceevent: Implement '%' operation tip-bot for Daniel Bristot de Oliveira <tipbot@zytor.com> - 2016-02-25 07:40 +0100
  [PATCH 1/4] tracing: Add __print_ns_to_secs() and __print_ns_without_secs() helpers Daniel Bristot de Oliveira <bristot@redhat.com> - 2016-02-22 18:20 +0100

csiph-web