All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "linux-trace-devel@vger.kernel.org"  <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd: Fix latency format to show latency
Date: Fri, 22 Nov 2019 16:55:37 -0500	[thread overview]
Message-ID: <20191122165537.26f89069@oasis.local.home> (raw)


From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

When trace-cmd report -l is used, the latency format is missing. This is
due to the show data routine not using TEP_PRINT_LATENCY. Need to change
the logic slightly where different parameters is sent to tep_print_event()
when latency_format is set, instead of just passing a different format
file.

Fixes: 150d479b623a ("libtraceevent, perf tools: Changes in tep_print_event_* APIs")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-read.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 4958fa81..a5813848 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -781,7 +781,6 @@ static void finish_wakeup(void)
 void trace_show_data(struct tracecmd_input *handle, struct tep_record *record)
 {
 	tracecmd_show_data_func func = tracecmd_get_show_data_func(handle);
-	const char *lfmt = latency_format ? "%8.8s-%-5d %3d" : "%16s-%-5d [%03d]";
 	const char *tfmt = tracecmd_get_flags(handle) & TRACECMD_FL_IN_USECS ? " %6.1000d:" : "%12d:";
 	struct tep_handle *pevent;
 	struct tep_event *event;
@@ -823,8 +822,17 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record)
 		}
 	}
 
-	tep_print_event(pevent, &s, record, lfmt, TEP_PRINT_COMM,
-			TEP_PRINT_PID, TEP_PRINT_CPU);
+	if (latency_format)
+		tep_print_event(pevent, &s, record, "%8.8s-%-5d %3d%s",
+				TEP_PRINT_COMM,
+				TEP_PRINT_PID,
+				TEP_PRINT_CPU,
+				TEP_PRINT_LATENCY);
+	else
+		tep_print_event(pevent, &s, record, "%16s-%-5d [%03d]",
+				TEP_PRINT_COMM,
+				TEP_PRINT_PID,
+				TEP_PRINT_CPU);
 	tep_print_event(pevent, &s, record, tfmt, TEP_PRINT_TIME);
 
 	if (tsdiff) {
-- 
2.24.0


                 reply	other threads:[~2019-11-22 21:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20191122165537.26f89069@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.