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@xxxxxxxxx> --- 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