From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> If the option TSC2NSECS is set, then display as microseconds like it does with trace clock local. This is because even though the x86-tsc is not in nanoseconds, the clock will be shifted and multiplied to be in nanoseconds, so it makes sense to convert it to seconds. Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- lib/trace-cmd/trace-input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c index 442b1c5a6724..e2ceff331869 100644 --- a/lib/trace-cmd/trace-input.c +++ b/lib/trace-cmd/trace-input.c @@ -3483,6 +3483,8 @@ static int handle_options(struct tracecmd_input *handle) buf + 4, 4); handle->tsc_calc.offset = tep_read_number(handle->pevent, buf + 8, 8); + if (!(handle->flags & TRACECMD_FL_RAW_TS)) + handle->flags |= TRACECMD_FL_IN_USECS; break; case TRACECMD_OPTION_HEADER_INFO: case TRACECMD_OPTION_FTRACE_EVENTS: @@ -3865,6 +3867,10 @@ static void extract_trace_clock(struct tracecmd_input *handle, char *line) if (handle->flags & TRACECMD_FL_RAW_TS) handle->flags &= ~TRACECMD_FL_IN_USECS; + /* tsc_calc is a conversion to nanoseconds */ + if (handle->tsc_calc.mult) + return; + /* Clear usecs if not one of the specified clocks */ if (strcmp(clock, "local") && strcmp(clock, "global") && strcmp(clock, "uptime") && strcmp(clock, "perf") && -- 2.35.1