diff mbox series

trace-cmd library: Have clock source TAI parse to seconds

Message ID 20220427183226.1ae6f8f6@gandalf.local.home (mailing list archive)
State Accepted
Commit 2fe1b7438cdabe8e260f41a197a58bc8f112876d
Headers show
Series trace-cmd library: Have clock source TAI parse to seconds | expand

Commit Message

Steven Rostedt April 27, 2022, 10:32 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

Tell trace-cmd that the "tai" clock source should be displayed in seconds
and needs to be parsed as such.

Instead of:

    sleep-2084  [001]1651097314396951318: function:             __mutex_unlock_slowpath
    sleep-2084  [001]1651097314396951516: function:             ktime_get_mono_fast_ns
    sleep-2084  [001]1651097314396951773: function:             ktime_get_mono_fast_ns
    sleep-2084  [001]1651097314396951773: function:             rcu_read_lock_sched_held
    sleep-2084  [001]1651097314396951949: function:             ktime_get_mono_fast_ns
    sleep-2084  [001]1651097314396952359: function:             ktime_get_mono_fast_ns

Display as:

    sleep-2084  [001] 1651097314.396951: function:             __mutex_unlock_slowpath
    sleep-2084  [001] 1651097314.396952: function:             ktime_get_mono_fast_ns
    sleep-2084  [001] 1651097314.396952: function:             ktime_get_mono_fast_ns
    sleep-2084  [001] 1651097314.396952: function:             rcu_read_lock_sched_held
    sleep-2084  [001] 1651097314.396952: function:             ktime_get_mono_fast_ns
    sleep-2084  [001] 1651097314.396952: function:             ktime_get_mono_fast_ns

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 lib/trace-cmd/trace-input.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 90bfa0f32984..442b1c5a6724 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3868,7 +3868,8 @@  static void extract_trace_clock(struct tracecmd_input *handle, char *line)
 	/* Clear usecs if not one of the specified clocks */
 	if (strcmp(clock, "local") && strcmp(clock, "global") &&
 	    strcmp(clock, "uptime") && strcmp(clock, "perf") &&
-	    strncmp(clock, "mono", 4) && strcmp(clock, TSCNSEC_CLOCK))
+	    strncmp(clock, "mono", 4) && strcmp(clock, TSCNSEC_CLOCK) &&
+	    strcmp(clock, "tai"))
 		handle->flags &= ~TRACECMD_FL_IN_USECS;
 }