[4/5] fix "trace-cmd reset" command to restore the default value of set_event_pid
diff mbox series

Message ID 20181213142125.12149-5-tstoyanov@vmware.com
State Superseded
Headers show
Series
  • trace-cmd reset fixes
Related show

Commit Message

Tzvetomir Stoyanov Dec. 13, 2018, 2:21 p.m. UTC
The "trace-cmd reset" command should restore ftrace to its default state.
This patch sets "tracing/set_event_pid" to an empty string,
when the "trace-cmd reset" command is executed.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
---
 tracecmd/trace-record.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Steven Rostedt March 5, 2019, 7:03 p.m. UTC | #1
I took the first 3 patches, but fixed the subject to say:

	trace-cmd: Fix ....

As all commits should have a "system:" format and the description part
start with a capital letter (note, this is the requirement for the
Linux kernel as well).

On Thu, 13 Dec 2018 14:21:43 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> The "trace-cmd reset" command should restore ftrace to its default state.
> This patch sets "tracing/set_event_pid" to an empty string,
> when the "trace-cmd reset" command is executed.
> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tracecmd/trace-record.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index 38d9871..f77e49a 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -3761,6 +3761,15 @@ static void reset_clock(void)
>  		write_instance_file(instance, "trace_clock", "local", "clock");
>  }
>  
> +static void reset_event_pid(void)
> +{
> +	struct buffer_instance *instance;
> +
> +	for_all_instances(instance)
> +		write_instance_file(instance, "set_event_pid", "", "event_pid");
> +}

Hmm, we should utilize "add_event_pid()" here instead, and simply pass
in an empty line.

Before doing that, make a clean up patch that makes add_event_pid()
utilize write_instance_file() instead of open coding it.

Thanks Tzvetomir!

-- Steve

> +
> +
>  static void clear_triggers(void)
>  {
>  	struct buffer_instance *instance;
> @@ -4464,6 +4473,7 @@ void trace_reset(int argc, char **argv)
>  	clear_triggers();
>  	/* set clock to "local" */
>  	reset_clock();
> +	reset_event_pid();
>  	tracecmd_remove_instances();
>  	clear_func_filters();
>  	/* restore tracing_on to 1 */

Patch
diff mbox series

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 38d9871..f77e49a 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3761,6 +3761,15 @@  static void reset_clock(void)
 		write_instance_file(instance, "trace_clock", "local", "clock");
 }
 
+static void reset_event_pid(void)
+{
+	struct buffer_instance *instance;
+
+	for_all_instances(instance)
+		write_instance_file(instance, "set_event_pid", "", "event_pid");
+}
+
+
 static void clear_triggers(void)
 {
 	struct buffer_instance *instance;
@@ -4464,6 +4473,7 @@  void trace_reset(int argc, char **argv)
 	clear_triggers();
 	/* set clock to "local" */
 	reset_clock();
+	reset_event_pid();
 	tracecmd_remove_instances();
 	clear_func_filters();
 	/* restore tracing_on to 1 */