All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 3/5] trace-cmd: Add check for trace_clock using usecs into tracecmd_parse_trace_clock()
Date: Tue, 17 Sep 2019 22:03:37 -0400	[thread overview]
Message-ID: <20190918020530.655810800@goodmis.org> (raw)
In-Reply-To: 20190918020334.344561631@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

In preparation for using the new tep_print_event() format, move the logic of
checking if the trace_clock used should be default as printed in usecs into
tracecmd_parse_trace_clock() when it parses the trace_clock.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace-cmd/trace-cmd.h | 1 +
 lib/trace-cmd/trace-input.c   | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index eb36a1f20c30..7c3bc2229461 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -87,6 +87,7 @@ enum {
 	TRACECMD_FL_IGNORE_DATE		= (1 << 0),
 	TRACECMD_FL_BUFFER_INSTANCE	= (1 << 1),
 	TRACECMD_FL_LATENCY		= (1 << 2),
+	TRACECMD_FL_IN_USECS		= (1 << 3),
 };
 
 struct tracecmd_ftrace {
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 5533d42fd7c2..73f27a4e50d0 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -2582,6 +2582,14 @@ static void extract_trace_clock(struct tracecmd_input *handle, char *line)
 	sscanf(data, "%ms", &clock);
 	/* TODO: report if it fails to allocate */
 	handle->trace_clock = clock;
+
+	if (!clock)
+		return;
+
+	if (!strcmp(clock, "local") || !strcmp(clock, "global")
+	    || !strcmp(clock, "uptime") || !strcmp(clock, "perf")
+	    || !strncmp(clock, "mono", 4))
+		handle->flags |= TRACECMD_FL_IN_USECS;
 }
 
 void tracecmd_parse_trace_clock(struct tracecmd_input *handle,
-- 
2.20.1



  parent reply	other threads:[~2019-09-18  2:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  2:03 [PATCH 0/5] trace-cmd: Update for the new trace_print_event() logic Steven Rostedt
2019-09-18  2:03 ` [PATCH 1/5] trace-cmd: Move extract trace_clock into trace-input.c Steven Rostedt
2019-09-20 14:55   ` Tzvetomir Stoyanov
2019-09-20 15:02     ` Steven Rostedt
2019-09-20 15:10     ` [PATCH 1/5 v2] " Steven Rostedt
2019-09-20 16:08       ` Tzvetomir Stoyanov
2019-09-20 16:11         ` Steven Rostedt
2019-09-18  2:03 ` [PATCH 2/5] trace-cmd: Separate out time diff code in trace_show_data() Steven Rostedt
2019-09-20 15:08   ` Tzvetomir Stoyanov
2019-09-18  2:03 ` Steven Rostedt [this message]
2019-09-20 15:10   ` [PATCH 3/5] trace-cmd: Add check for trace_clock using usecs into tracecmd_parse_trace_clock() Tzvetomir Stoyanov
2019-09-18  2:03 ` [PATCH 4/5] libtraceevent, perf tools: Changes in tep_print_event_* APIs Steven Rostedt
2019-09-19 22:50   ` Steven Rostedt
2019-09-19 22:53     ` [PATCH 4/5 v2] " Steven Rostedt
2019-09-20 16:06     ` [PATCH 4/5] " Tzvetomir Stoyanov
2019-09-19 22:52   ` Steven Rostedt
2019-09-18  2:03 ` [PATCH 5/5] tools/lib/traceevent: Round up in tep_print_event() time precision Steven Rostedt
2019-09-20 15:18   ` Tzvetomir Stoyanov

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=20190918020530.655810800@goodmis.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.