trace-cmd: Fix latency format to show latency
PATCH 1/1 trace-cmd: Fix latency format to show latency
From: "Steven Rostedt (VMware)" <[email protected]>
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) <[email protected]>
--- tracecmd/trace-read.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
tracecmd/trace-read.c +11 -3
@@ -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) {
Signature · 1 line
2.24.0