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

Message ID 20181213142125.12149-6-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/tracing_max_latency" to 0,
when the "trace-cmd reset" command is executed.

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

Comments

Steven Rostedt March 5, 2019, 7:06 p.m. UTC | #1
On Thu, 13 Dec 2018 14:21:44 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> The "trace-cmd reset" command should restore ftrace to its default state.
> This patch sets "tracing/tracing_max_latency" to 0,
> when the "trace-cmd reset" command is executed.
> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  tracecmd/trace-record.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index f77e49a..a9bcd8d 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -3769,6 +3769,14 @@ static void reset_event_pid(void)
>  		write_instance_file(instance, "set_event_pid", "", "event_pid");
>  }
>  
> +static void reset_max_latency_instance(void)
> +{
> +	struct buffer_instance *instance;
> +
> +	for_all_instances(instance)
> +		write_instance_file(instance,
> +				    "tracing_max_latency", "0", "max_latency");
> +}

We should fix reset_max_latency() use write_instance_file, and then
make a reset_max_latency_instance() to call it on all instance.

-- Steve

>  
>  static void clear_triggers(void)
>  {
> @@ -4474,6 +4482,7 @@ void trace_reset(int argc, char **argv)
>  	/* set clock to "local" */
>  	reset_clock();
>  	reset_event_pid();
> +	reset_max_latency_instance();
>  	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 f77e49a..a9bcd8d 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3769,6 +3769,14 @@  static void reset_event_pid(void)
 		write_instance_file(instance, "set_event_pid", "", "event_pid");
 }
 
+static void reset_max_latency_instance(void)
+{
+	struct buffer_instance *instance;
+
+	for_all_instances(instance)
+		write_instance_file(instance,
+				    "tracing_max_latency", "0", "max_latency");
+}
 
 static void clear_triggers(void)
 {
@@ -4474,6 +4482,7 @@  void trace_reset(int argc, char **argv)
 	/* set clock to "local" */
 	reset_clock();
 	reset_event_pid();
+	reset_max_latency_instance();
 	tracecmd_remove_instances();
 	clear_func_filters();
 	/* restore tracing_on to 1 */