Message ID | 20210324130418.436206-17-tz.stoyanov@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | TSC trace clock to nanosecond conversion | expand |
On Wed, 24 Mar 2021 15:04:11 +0200 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote: > @@ -2601,7 +2605,8 @@ static int handle_options(struct tracecmd_input *handle) > * gtod. It is stored as ASCII with '0x' > * appended. > */ > - if (handle->flags & TRACECMD_FL_IGNORE_DATE) > + if (handle->flags & > + (TRACECMD_FL_IGNORE_DATE || TRACECMD_FL_RAW_TS)) Needs to be a binary 'or' "|", not a logical 'or' "||", as the above is the same as: if (handle->flags & 1) If I don't find anything else wrong in this series, I'll fix this myself. -- Steve > break; > offset = strtoll(buf, NULL, 0); > /* Convert from micro to nano */
On Wed, 24 Mar 2021 10:24:24 -0400 Steven Rostedt <rostedt@goodmis.org> wrote: > On Wed, 24 Mar 2021 15:04:11 +0200 > "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote: > > > @@ -2601,7 +2605,8 @@ static int handle_options(struct tracecmd_input *handle) > > * gtod. It is stored as ASCII with '0x' > > * appended. > > */ > > - if (handle->flags & TRACECMD_FL_IGNORE_DATE) > > + if (handle->flags & > > + (TRACECMD_FL_IGNORE_DATE || TRACECMD_FL_RAW_TS)) > > Needs to be a binary 'or' "|", not a logical 'or' "||", as the above is the > same as: if (handle->flags & 1) > > If I don't find anything else wrong in this series, I'll fix this myself. > As I'm finding more things to fix, please do this update in your next revision. -- Steve
diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h index c33d067a..fdca7494 100644 --- a/lib/trace-cmd/include/private/trace-cmd-private.h +++ b/lib/trace-cmd/include/private/trace-cmd-private.h @@ -134,6 +134,7 @@ enum { TRACECMD_FL_IGNORE_DATE = (1 << 0), TRACECMD_FL_BUFFER_INSTANCE = (1 << 1), TRACECMD_FL_IN_USECS = (1 << 2), + TRACECMD_FL_RAW_TS = (1 << 3), }; struct tracecmd_ftrace { diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index 696e7bd8..27ddd8eb 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -1287,6 +1287,10 @@ static unsigned long long timestamp_host_sync(unsigned long long ts, static unsigned long long timestamp_calc(unsigned long long ts, struct tracecmd_input *handle) { + /* do not modify raw timestamps */ + if (handle->flags & TRACECMD_FL_RAW_TS) + return ts; + /* Guest trace file, sync with host timestamps */ if (handle->host.sync_enable) ts = timestamp_host_sync(ts, handle); @@ -2601,7 +2605,8 @@ static int handle_options(struct tracecmd_input *handle) * gtod. It is stored as ASCII with '0x' * appended. */ - if (handle->flags & TRACECMD_FL_IGNORE_DATE) + if (handle->flags & + (TRACECMD_FL_IGNORE_DATE || TRACECMD_FL_RAW_TS)) break; offset = strtoll(buf, NULL, 0); /* Convert from micro to nano */ @@ -2707,7 +2712,7 @@ static int handle_options(struct tracecmd_input *handle) trace_guest_load(handle, buf, size); break; case TRACECMD_OPTION_TSC2NSEC: - if (size < 16) + if (size < 16 || (handle->flags & TRACECMD_FL_RAW_TS)) break; handle->tsc_calc.mult = tep_read_number(handle->pevent, buf, 4);
A new flag is added in the trace-cmd library for controlling events timestamp corrections while reading a trace file. If the flag is set, all timestamps are displayed as-is from the trace file. TRACECMD_FL_RAW_TS The flag can be modified with these APIs: tracecmd_set_flag() tracecmd_clear_flag() Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- lib/trace-cmd/include/private/trace-cmd-private.h | 1 + lib/trace-cmd/trace-input.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)