From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 1/2] trace-cmd: Enable TS correction by default
Date: Thu, 4 Mar 2021 15:11:11 +0200 [thread overview]
Message-ID: <20210304131112.204294-2-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210304131112.204294-1-tz.stoyanov@gmail.com>
When opening a trace.dat file with trace-cmd library, apply time stamps
corrections from the file's metadata by default. This default behaviour
can be disabled with flag TRACECMD_FL_IGNORE_DATE using tracecmd_set_flag()
API, before reading the tracing data. There is also a "trace-cmd report"
option for ignoring any timestamp corrections: "--nodate".
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
lib/trace-cmd/trace-input.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 9ef7b9f1..134f6220 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -1167,6 +1167,9 @@ static unsigned long long timestamp_correct(unsigned long long ts,
struct host_trace_info *host = &handle->host;
int min, mid, max;
+ if (handle->flags & TRACECMD_FL_IGNORE_DATE)
+ return ts;
+
if (handle->ts_offset)
return ts + handle->ts_offset;
@@ -2585,6 +2588,7 @@ static int handle_options(struct tracecmd_input *handle)
if (!handle->host.ts_samples)
return -ENOMEM;
tsync_offset_load(handle, buf + 16);
+ tracecmd_enable_tsync(handle, true);
break;
case TRACECMD_OPTION_CPUSTAT:
buf[size-1] = '\n';
--
2.29.2
next prev parent reply other threads:[~2021-03-04 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 13:11 [PATCH 0/2] trace-cmd: Apply time stamp corrections by default Tzvetomir Stoyanov (VMware)
2021-03-04 13:11 ` Tzvetomir Stoyanov (VMware) [this message]
2021-03-04 13:11 ` [PATCH 2/2] trace-cmd: Remove APIs for pairing a tracing peer Tzvetomir Stoyanov (VMware)
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=20210304131112.204294-2-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.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).