* [PATCH] trace-cmd library: Process trace_clock for v7 trace.dat files
@ 2022-04-04 15:10 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-04-04 15:10 UTC (permalink / raw)
  To: Linux Trace Devel
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 --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;
-- 
2.35.1
^ permalink raw reply related	[flat|nested] only message in thread
only message in thread, other threads:[~2022-04-04 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-04 15:10 [PATCH] trace-cmd library: Process trace_clock for v7 trace.dat files Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).