diff mbox series

[v2,6/6] trace-cmd: Fix "trace-cmd reset" command to restore the default value of tracing_max_latency

Message ID 20190308134405.21921-7-tstoyanov@vmware.com (mailing list archive)
State Superseded
Headers show
Series trace-cmd reset fixes | expand

Commit Message

Tzvetomir Stoyanov March 8, 2019, 1:44 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(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index bdf0c02..f4dac2f 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3801,6 +3801,14 @@  static void reset_event_pid(void)
 	add_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)
 {
@@ -4506,6 +4514,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 */