diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-06-16 17:44:33 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-06-16 17:44:33 -0400 |
commit | 0fe4f4465547c9cf3fdb51a611f816d580036fdf (patch) | |
tree | c011a7e2ea64d1e302442d8b03e0a464f0df639b | |
parent | 22be8b7ddcb744cc206bc369ab4c2e2a4e16f45d (diff) |
trace-cmd: Always enabled tracing_enabled
The tracing_enabled file really needs to be deprecated. It should
not be used. But if the tracing_enabled file gets set to zero
somehow (by either the user or tool - latencytop?) then it will
disable output.
Since trace-cmd does not touch the file, it will confuse users
when they see no data recorded.
The simple answer is to always set tracing_enabled to one if the
file exists.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-cmd.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index d567ed8..4c17062 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -759,6 +759,28 @@ static void update_event(const char *name, const char *filter, | |||
759 | 759 | ||
760 | } | 760 | } |
761 | 761 | ||
762 | /* | ||
763 | * The debugfs file tracing_enabled needs to be deprecated. | ||
764 | * But just in case anyone fiddled with it. If it exists, | ||
765 | * make sure it is one. | ||
766 | * No error checking needed here. | ||
767 | */ | ||
768 | static void check_tracing_enabled(void) | ||
769 | { | ||
770 | static int fd = -1; | ||
771 | char *path; | ||
772 | |||
773 | if (fd < 0) { | ||
774 | path = get_tracing_file("tracing_enabled"); | ||
775 | fd = open(path, O_WRONLY); | ||
776 | put_tracing_file(path); | ||
777 | |||
778 | if (fd < 0) | ||
779 | return; | ||
780 | } | ||
781 | write(fd, "1", 1); | ||
782 | } | ||
783 | |||
762 | static void write_tracing_on(int on) | 784 | static void write_tracing_on(int on) |
763 | { | 785 | { |
764 | static int fd = -1; | 786 | static int fd = -1; |
@@ -784,6 +806,8 @@ static void write_tracing_on(int on) | |||
784 | 806 | ||
785 | static void enable_tracing(void) | 807 | static void enable_tracing(void) |
786 | { | 808 | { |
809 | check_tracing_enabled(); | ||
810 | |||
787 | write_tracing_on(1); | 811 | write_tracing_on(1); |
788 | 812 | ||
789 | if (latency) | 813 | if (latency) |