Skip to content

Commit 6752ab4

Browse files
Steven Rostedtrostedt
authored andcommitted
tracing: Deprecate tracing_enabled for tracing_on
tracing_enabled should not be used, it is heavy weight and does not do much in helping lower the overhead. tracing_on should be used instead. Warn users to use tracing_on when tracing_enabled is used as it will soon be removed from the tracing directory. Signed-off-by: Steven Rostedt <[email protected]>
1 parent 87d80de commit 6752ab4

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

Documentation/trace/ftrace.txt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ of ftrace. Here is a list of some of the key files:
8080
tracers listed here can be configured by
8181
echoing their name into current_tracer.
8282

83-
tracing_enabled:
83+
tracing_on:
8484

85-
This sets or displays whether the current_tracer
86-
is activated and tracing or not. Echo 0 into this
87-
file to disable the tracer or 1 to enable it.
85+
This sets or displays whether writing to the trace
86+
ring buffer is enabled. Echo 0 into this file to disable
87+
the tracer or 1 to enable it.
8888

8989
trace:
9090

@@ -497,10 +497,10 @@ an example:
497497
# echo irqsoff > current_tracer
498498
# echo latency-format > trace_options
499499
# echo 0 > tracing_max_latency
500-
# echo 1 > tracing_enabled
500+
# echo 1 > tracing_on
501501
# ls -ltr
502502
[...]
503-
# echo 0 > tracing_enabled
503+
# echo 0 > tracing_on
504504
# cat trace
505505
# tracer: irqsoff
506506
#
@@ -605,10 +605,10 @@ is much like the irqsoff tracer.
605605
# echo preemptoff > current_tracer
606606
# echo latency-format > trace_options
607607
# echo 0 > tracing_max_latency
608-
# echo 1 > tracing_enabled
608+
# echo 1 > tracing_on
609609
# ls -ltr
610610
[...]
611-
# echo 0 > tracing_enabled
611+
# echo 0 > tracing_on
612612
# cat trace
613613
# tracer: preemptoff
614614
#
@@ -753,10 +753,10 @@ tracers.
753753
# echo preemptirqsoff > current_tracer
754754
# echo latency-format > trace_options
755755
# echo 0 > tracing_max_latency
756-
# echo 1 > tracing_enabled
756+
# echo 1 > tracing_on
757757
# ls -ltr
758758
[...]
759-
# echo 0 > tracing_enabled
759+
# echo 0 > tracing_on
760760
# cat trace
761761
# tracer: preemptirqsoff
762762
#
@@ -916,9 +916,9 @@ Instead of performing an 'ls', we will run 'sleep 1' under
916916
# echo wakeup > current_tracer
917917
# echo latency-format > trace_options
918918
# echo 0 > tracing_max_latency
919-
# echo 1 > tracing_enabled
919+
# echo 1 > tracing_on
920920
# chrt -f 5 sleep 1
921-
# echo 0 > tracing_enabled
921+
# echo 0 > tracing_on
922922
# cat trace
923923
# tracer: wakeup
924924
#
@@ -1030,9 +1030,9 @@ ftrace_enabled is set; otherwise this tracer is a nop.
10301030

10311031
# sysctl kernel.ftrace_enabled=1
10321032
# echo function > current_tracer
1033-
# echo 1 > tracing_enabled
1033+
# echo 1 > tracing_on
10341034
# usleep 1
1035-
# echo 0 > tracing_enabled
1035+
# echo 0 > tracing_on
10361036
# cat trace
10371037
# tracer: function
10381038
#
@@ -1070,7 +1070,7 @@ int trace_fd;
10701070
[...]
10711071
int main(int argc, char *argv[]) {
10721072
[...]
1073-
trace_fd = open(tracing_file("tracing_enabled"), O_WRONLY);
1073+
trace_fd = open(tracing_file("tracing_on"), O_WRONLY);
10741074
[...]
10751075
if (condition_hit()) {
10761076
write(trace_fd, "0", 1);
@@ -1521,9 +1521,9 @@ If I am only interested in sys_nanosleep and hrtimer_interrupt:
15211521
# echo sys_nanosleep hrtimer_interrupt \
15221522
> set_ftrace_filter
15231523
# echo function > current_tracer
1524-
# echo 1 > tracing_enabled
1524+
# echo 1 > tracing_on
15251525
# usleep 1
1526-
# echo 0 > tracing_enabled
1526+
# echo 0 > tracing_on
15271527
# cat trace
15281528
# tracer: ftrace
15291529
#
@@ -1769,9 +1769,9 @@ different. The trace is live.
17691769
# echo function > current_tracer
17701770
# cat trace_pipe > /tmp/trace.out &
17711771
[1] 4153
1772-
# echo 1 > tracing_enabled
1772+
# echo 1 > tracing_on
17731773
# usleep 1
1774-
# echo 0 > tracing_enabled
1774+
# echo 0 > tracing_on
17751775
# cat trace
17761776
# tracer: function
17771777
#

kernel/trace/trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,6 +2710,10 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
27102710

27112711
mutex_lock(&trace_types_lock);
27122712
if (tracer_enabled ^ val) {
2713+
2714+
/* Only need to warn if this is used to change the state */
2715+
WARN_ONCE(1, "tracing_enabled is deprecated. Use tracing_on");
2716+
27132717
if (val) {
27142718
tracer_enabled = 1;
27152719
if (current_trace->start)

0 commit comments

Comments
 (0)