Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] trace-cmd: Fix latency format to show latency
@ 2019-11-22 21:55 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2019-11-22 21:55 UTC (permalink / raw)
  To: linux-trace-devel


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 21:55 [PATCH] trace-cmd: Fix latency format to show latency Steven Rostedt

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git