From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/2] trace-cmd: Add error_log dump to trace-cmd stat command
Date: Thu, 16 Apr 2020 10:22:44 +0300 [thread overview]
Message-ID: <20200416072244.50239-3-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20200416072244.50239-1-tz.stoyanov@gmail.com>
In case of a ftrace configuration problem, the description
of the error is printed in the error_log file. It is useful
to dump all recorded errors in "trace-cmd stat" command.
Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207291
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
Documentation/trace-cmd-stat.1.txt | 2 ++
tracecmd/trace-stat.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/Documentation/trace-cmd-stat.1.txt b/Documentation/trace-cmd-stat.1.txt
index 004fbaa5..2f1a9c8b 100644
--- a/Documentation/trace-cmd-stat.1.txt
+++ b/Documentation/trace-cmd-stat.1.txt
@@ -43,6 +43,8 @@ system. The status that it shows is:
*Uprobes:* Shows any uprobes that are defined for tracing.
+*Error log:* Dump the content of ftrace error_log file.
+
SEE ALSO
--------
trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
diff --git a/tracecmd/trace-stat.c b/tracecmd/trace-stat.c
index 3f7b3493..c5057978 100644
--- a/tracecmd/trace-stat.c
+++ b/tracecmd/trace-stat.c
@@ -897,6 +897,22 @@ static void report_traceon(struct buffer_instance *instance)
free(str);
}
+static void report_errorlog(struct buffer_instance *instance)
+{
+ char *str;
+
+ if (!tracefs_file_exists(instance->tracefs, "error_log"))
+ return;
+ str = get_instance_file_content(instance, "error_log");
+ if (!str)
+ return;
+
+ if (str[0])
+ printf("\nError log:\n%s\n", str);
+
+ free(str);
+}
+
static void stat_instance(struct buffer_instance *instance)
{
if (instance != &top_instance) {
@@ -920,6 +936,7 @@ static void stat_instance(struct buffer_instance *instance)
report_kprobes(instance);
report_uprobes(instance);
report_traceon(instance);
+ report_errorlog(instance);
}
void trace_stat (int argc, char **argv)
--
2.25.1
prev parent reply other threads:[~2020-04-16 7:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 7:22 [PATCH 0/2] Enhancements of the "trace-cmd stat" command Tzvetomir Stoyanov (VMware)
2020-04-16 7:22 ` [PATCH 1/2] trace-cmd: Update tarce-cmd stat man page with instances list Tzvetomir Stoyanov (VMware)
2020-04-16 7:22 ` Tzvetomir Stoyanov (VMware) [this message]
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=20200416072244.50239-3-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.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 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).