[3/5] fix "trace-cmd reset" command to restore default clock
diff mbox series

Message ID 20181213142125.12149-4-tstoyanov@vmware.com
State New
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/trace_clock" to its default value "local",
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(+)

Patch
diff mbox series

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index e02660a..38d9871 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3753,6 +3753,14 @@  static void clear_filters(void)
 		clear_instance_filters(instance);
 }
 
+static void reset_clock(void)
+{
+	struct buffer_instance *instance;
+
+	for_all_instances(instance)
+		write_instance_file(instance, "trace_clock", "local", "clock");
+}
+
 static void clear_triggers(void)
 {
 	struct buffer_instance *instance;
@@ -4454,6 +4462,8 @@  void trace_reset(int argc, char **argv)
 	set_buffer_size();
 	clear_filters();
 	clear_triggers();
+	/* set clock to "local" */
+	reset_clock();
 	tracecmd_remove_instances();
 	clear_func_filters();
 	/* restore tracing_on to 1 */