linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd library: Process trace_clock for v7 trace.dat files
Date: Mon, 4 Apr 2022 11:10:37 -0400	[thread overview]
Message-ID: <20220404111037.2248bb52@gandalf.local.home> (raw)

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


                 reply	other threads:[~2022-04-04 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220404111037.2248bb52@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).