From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Yordan Karadzhov <y.karadz@gmail.com>
Subject: [PATCH] trace-cmd report: Update tep_func_repeat_format to match ts
Date: Tue, 13 Apr 2021 17:30:00 -0400 [thread overview]
Message-ID: <20210413173000.3e377bcc@gandalf.local.home> (raw)
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>
---
This time with "[PATCH]" in the subject :-p
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 */
reply other threads:[~2021-04-13 21:30 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=20210413173000.3e377bcc@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=y.karadz@gmail.com \
/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 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).