linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* trace-cmd report: Update tep_func_repeat_format to match ts
@ 2021-04-13 21:14 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2021-04-13 21:14 UTC (permalink / raw)
  To: Linux Trace Devel; +Cc: Yordan Karadzhov

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

With the new func_repeats event coming to the kernel, libtraceevent is
adding a way to process that event, and will display the timestamp of the
last function that repeated.

To make sure the displaying of that format matches the displaying of the
timestamps generated, update the tep_func_repeat_format variable to keep it
the same.

As the tep_func_repeat_format is a weak variable in the function plugin of
libtraceevent, it only needs to be defined to update it. Defining the
variable will not limit trace-cmd from using older libtraceevent libraries
that do not yet have this support.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index d962b671..b2c473d1 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -26,6 +26,14 @@
 #include "kbuffer.h"
 #include "list.h"
 
+/*
+ * tep_func_repeat_format is defined as a weak variable in the
+ * libtraceevent library function plugin, to allow applications
+ * to override the format of the timestamp it prints for the
+ * last function that repeated.
+ */
+const char *tep_func_repeat_format;
+
 static struct filter_str {
 	struct filter_str	*next;
 	char			*filter;
@@ -1875,6 +1883,18 @@ void trace_report (int argc, char **argv)
 
 	otype = OUTPUT_NORMAL;
 
+	if (tracecmd_get_flags(handle) & TRACECMD_FL_RAW_TS) {
+		tep_func_repeat_format = "%d";
+	} else if (tracecmd_get_flags(handle) & TRACECMD_FL_IN_USECS) {
+		if (tep_test_flag(tracecmd_get_tep(handle), TEP_NSEC_OUTPUT))
+			tep_func_repeat_format = "%9.1d";
+		else
+			tep_func_repeat_format = "%6.1000d";
+	} else {
+		tep_func_repeat_format = "%12d";
+	}
+
+
 	if (show_stat)
 		otype = OUTPUT_STAT_ONLY;
 	/* yeah yeah, uname overrides stat */

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

only message in thread, other threads:[~2021-04-13 21:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 21:14 trace-cmd report: Update tep_func_repeat_format to match ts Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).