Skip to contentSkip to conversation

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

PATCH New Steven Rostedt 1 participant 1 message Apr 4, 2022

lore
Share & tools
lore
#0 lore raw

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

From: "Steven Rostedt (Google)" <[email protected]>

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")
---
 lib/trace-cmd/trace-input.c | 1 +
 1 file changed, 1 insertion(+)
lib/trace-cmd/trace-input.c +1 -0
index 18bb4cf984da..b8705ce364d1 100644
@@ -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;
Signature · 1 line
2.35.1