diff mbox series

trace-cmd library: Process trace_clock for v7 trace.dat files

Message ID 20220404111037.2248bb52@gandalf.local.home (mailing list archive)
State Accepted
Commit 93905494355b23d4323e59bc53aa1cfb01402fe6
Headers show
Series trace-cmd library: Process trace_clock for v7 trace.dat files | expand

Commit Message

Steven Rostedt April 4, 2022, 3:10 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

One of my ftrace tests records tracing data with the counter clock (just
counts by 1 for every event, it is not a time stamp), but the test failed
with the latest trace-cmd, as it was showing the counters as "usecs" and
truncating them:

Instead of:

          <idle>-0     [002]      818923: sched_switch:         swapper/2:0 [120] R ==> sleep:8298 [120]
          <idle>-0     [003]      818924: sched_switch:         swapper/3:0 [120] R ==> rb_consumer:47 [139]
          <idle>-0     [000]      818925: sched_switch:         swapper/0:0 [120] R ==> trace-cmd:8293 [120]
           sleep-8298  [002]      818926: sched_switch:         sleep:8298 [120] Z ==> swapper/2:0 [120]

It was showing the output like:

           sleep-8225  [002]     0.000809: sched_switch:         sleep:8225 [120] S ==> swapper/2:0 [120]
          <idle>-0     [003]     0.000809: sched_switch:         swapper/3:0 [120] R ==> rcu_preempt:13 [120]
     rcu_preempt-13    [003]     0.000809: sched_switch:         rcu_preempt:13 [120] W ==> swapper/3:0 [120]
          <idle>-0     [003]     0.000809: sched_switch:         swapper/3:0 [120] R ==> rcu_preempt:13 [120]

When the TRACECLOCK option is found, use it to set the appropriate clock
for trace-cmd.

Fixes: 02dfe3593624 ("trace-cmd library: Initialize CPU data for reading from version 7 trace files")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/trace-input.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 18bb4cf984da..b8705ce364d1 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3436,6 +3436,7 @@  static int handle_options(struct tracecmd_input *handle)
 				goto out;
 			break;
 		case TRACECMD_OPTION_TRACECLOCK:
+			tracecmd_parse_trace_clock(handle, buf, size);
 			if (!handle->ts2secs)
 				handle->use_trace_clock = true;
 			break;