From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH v4 4/4] trace-cmd: Clear error log on reset subcommand
Date: Tue, 25 Feb 2020 20:07:33 +0200 [thread overview]
Message-ID: <20200225180733.89344-5-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20200225180733.89344-1-tz.stoyanov@gmail.com>
The "trace-cmd reset" command is supposed to set the ftrace state to default.
However, the ftrace error logs are not reseted.
A logic is added to delete the content of "error_log" file when "trace-cmd reset" is executed.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
tracecmd/trace-record.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 7c76ffa8..5c65a26f 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -4638,6 +4638,28 @@ static void clear_triggers(void)
clear_instance_triggers(instance);
}
+static void clear_instance_error_log(struct buffer_instance *instance)
+{
+ char *file;
+
+ if (!tracefs_file_exist(instance->tracefs, "error_log"))
+ return;
+
+ file = tracefs_instance_get_file(instance->tracefs, "error_log");
+ if (!file)
+ return;
+ write_file(file, " ");
+ tracefs_put_tracing_file(file);
+}
+
+static void clear_error_log(void)
+{
+ struct buffer_instance *instance;
+
+ for_all_instances(instance)
+ clear_instance_error_log(instance);
+}
+
static void clear_all_synth_events(void)
{
char sevent[BUFSIZ];
@@ -5382,6 +5404,7 @@ void trace_reset(int argc, char **argv)
clear_filters();
clear_triggers();
clear_all_synth_events();
+ clear_error_log();
/* set clock to "local" */
reset_clock();
reset_event_pid();
--
2.24.1
prev parent reply other threads:[~2020-02-25 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 18:07 [PATCH v4 0/4] Extend coverage of "trace-cmd reset" command Tzvetomir Stoyanov (VMware)
2020-02-25 18:07 ` [PATCH v4 1/4] trace-cmd: Add new tracefs APIs for checking if a ftrace file / directory exists Tzvetomir Stoyanov (VMware)
2020-04-09 18:22 ` Steven Rostedt
2020-04-13 6:52 ` Tzvetomir Stoyanov
2020-02-25 18:07 ` [PATCH v4 2/4] trace-cmd: Unit tests for new libtracefs APIs Tzvetomir Stoyanov (VMware)
2020-02-25 18:07 ` [PATCH v4 3/4] trace-cmd: Clear synthetic events on reset subcommand Tzvetomir Stoyanov (VMware)
2020-02-25 18:07 ` 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=20200225180733.89344-5-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).