Commit 2abfcd29 authored by Ross Zwisler's avatar Ross Zwisler Committed by Jonathan Corbet

docs: ftrace: always use canonical ftrace path

The canonical location for the tracefs filesystem is at /sys/kernel/tracing.

But, from Documentation/trace/ftrace.rst:

  Before 4.1, all ftrace tracing control files were within the debugfs
  file system, which is typically located at /sys/kernel/debug/tracing.
  For backward compatibility, when mounting the debugfs file system,
  the tracefs file system will be automatically mounted at:

  /sys/kernel/debug/tracing

Many parts of Documentation still reference this older debugfs path, so
let's update them to avoid confusion.
Signed-off-by: default avatarRoss Zwisler <zwisler@google.com>
Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20230125213251.2013791-1-zwisler@google.comSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent b05ada56
...@@ -6288,7 +6288,7 @@ ...@@ -6288,7 +6288,7 @@
that can be enabled or disabled just as if you were that can be enabled or disabled just as if you were
to echo the option name into to echo the option name into
/sys/kernel/debug/tracing/trace_options /sys/kernel/tracing/trace_options
For example, to enable stacktrace option (to dump the For example, to enable stacktrace option (to dump the
stack trace of each event), add to the command line: stack trace of each event), add to the command line:
...@@ -6321,7 +6321,7 @@ ...@@ -6321,7 +6321,7 @@
[FTRACE] enable this option to disable tracing when a [FTRACE] enable this option to disable tracing when a
warning is hit. This turns off "tracing_on". Tracing can warning is hit. This turns off "tracing_on". Tracing can
be enabled again by echoing '1' into the "tracing_on" be enabled again by echoing '1' into the "tracing_on"
file located in /sys/kernel/debug/tracing/ file located in /sys/kernel/tracing/
This option is useful, as it disables the trace before This option is useful, as it disables the trace before
the WARNING dump is called, which prevents the trace to the WARNING dump is called, which prevents the trace to
......
...@@ -25,7 +25,7 @@ References ...@@ -25,7 +25,7 @@ References
- In order to locate kernel-generated OS jitter on CPU N: - In order to locate kernel-generated OS jitter on CPU N:
cd /sys/kernel/debug/tracing cd /sys/kernel/tracing
echo 1 > max_graph_depth # Increase the "1" for more detail echo 1 > max_graph_depth # Increase the "1" for more detail
echo function_graph > current_tracer echo function_graph > current_tracer
# run workload # run workload
......
...@@ -712,7 +712,7 @@ it works in the `active mode <Active Mode_>`_. ...@@ -712,7 +712,7 @@ it works in the `active mode <Active Mode_>`_.
The following sequence of shell commands can be used to enable them and see The following sequence of shell commands can be used to enable them and see
their output (if the kernel is generally configured to support event tracing):: their output (if the kernel is generally configured to support event tracing)::
# cd /sys/kernel/debug/tracing/ # cd /sys/kernel/tracing/
# echo 1 > events/power/pstate_sample/enable # echo 1 > events/power/pstate_sample/enable
# echo 1 > events/power/cpu_frequency/enable # echo 1 > events/power/cpu_frequency/enable
# cat trace # cat trace
...@@ -732,7 +732,7 @@ The ``ftrace`` interface can be used for low-level diagnostics of ...@@ -732,7 +732,7 @@ The ``ftrace`` interface can be used for low-level diagnostics of
P-state is called, the ``ftrace`` filter can be set to P-state is called, the ``ftrace`` filter can be set to
:c:func:`intel_pstate_set_pstate`:: :c:func:`intel_pstate_set_pstate`::
# cd /sys/kernel/debug/tracing/ # cd /sys/kernel/tracing/
# cat available_filter_functions | grep -i pstate # cat available_filter_functions | grep -i pstate
intel_pstate_set_pstate intel_pstate_set_pstate
intel_pstate_cpu_init intel_pstate_cpu_init
......
...@@ -370,8 +370,8 @@ of possible problems: ...@@ -370,8 +370,8 @@ of possible problems:
The first one can be tracked using tracing: :: The first one can be tracked using tracing: ::
$ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event $ echo workqueue:workqueue_queue_work > /sys/kernel/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace_pipe > out.txt $ cat /sys/kernel/tracing/trace_pipe > out.txt
(wait a few secs) (wait a few secs)
^C ^C
......
...@@ -344,8 +344,8 @@ Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space. ...@@ -344,8 +344,8 @@ Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space.
To debug ISH, event tracing mechanism is used. To enable debug logs:: To debug ISH, event tracing mechanism is used. To enable debug logs::
echo 1 > /sys/kernel/debug/tracing/events/intel_ish/enable echo 1 > /sys/kernel/tracing/events/intel_ish/enable
cat /sys/kernel/debug/tracing/trace cat /sys/kernel/tracing/trace
3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260 3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
----------------------------------------------------- -----------------------------------------------------
......
...@@ -651,14 +651,14 @@ via power-saving behavior. ...@@ -651,14 +651,14 @@ via power-saving behavior.
Enabling all tracepoints can be done like Enabling all tracepoints can be done like
:: ::
# echo 1 > /sys/kernel/debug/tracing/events/hda/enable # echo 1 > /sys/kernel/tracing/events/hda/enable
then after some commands, you can traces from then after some commands, you can traces from
/sys/kernel/debug/tracing/trace file. For example, when you want to /sys/kernel/tracing/trace file. For example, when you want to
trace what codec command is sent, enable the tracepoint like: trace what codec command is sent, enable the tracepoint like:
:: ::
# cat /sys/kernel/debug/tracing/trace # cat /sys/kernel/tracing/trace
# tracer: nop # tracer: nop
# #
# TASK-PID CPU# TIMESTAMP FUNCTION # TASK-PID CPU# TIMESTAMP FUNCTION
......
...@@ -8,7 +8,7 @@ at https://www.intel.com/sdm (Volume 3) ...@@ -8,7 +8,7 @@ at https://www.intel.com/sdm (Volume 3)
Available trace points: Available trace points:
/sys/kernel/debug/tracing/events/msr/ /sys/kernel/tracing/events/msr/
Trace MSR reads: Trace MSR reads:
...@@ -34,7 +34,7 @@ rdpmc ...@@ -34,7 +34,7 @@ rdpmc
The trace data can be post processed with the postprocess/decode_msr.py script:: The trace data can be post processed with the postprocess/decode_msr.py script::
cat /sys/kernel/debug/tracing/trace | decode_msr.py /usr/src/linux/include/asm/msr-index.h cat /sys/kernel/tracing/trace | decode_msr.py /usr/src/linux/include/asm/msr-index.h
to add symbolic MSR names. to add symbolic MSR names.
...@@ -4,7 +4,7 @@ NMI Trace Events ...@@ -4,7 +4,7 @@ NMI Trace Events
These events normally show up here: These events normally show up here:
/sys/kernel/debug/tracing/events/nmi /sys/kernel/tracing/events/nmi
nmi_handler nmi_handler
...@@ -31,13 +31,13 @@ really hogging a lot of CPU time, like a millisecond at a time. ...@@ -31,13 +31,13 @@ really hogging a lot of CPU time, like a millisecond at a time.
Note that the kernel's output is in milliseconds, but the input Note that the kernel's output is in milliseconds, but the input
to the filter is in nanoseconds! You can filter on 'delta_ns':: to the filter is in nanoseconds! You can filter on 'delta_ns'::
cd /sys/kernel/debug/tracing/events/nmi/nmi_handler cd /sys/kernel/tracing/events/nmi/nmi_handler
echo 'handler==0xffffffff81625600 && delta_ns>1000000' > filter echo 'handler==0xffffffff81625600 && delta_ns>1000000' > filter
echo 1 > enable echo 1 > enable
Your output would then look like:: Your output would then look like::
$ cat /sys/kernel/debug/tracing/trace_pipe $ cat /sys/kernel/tracing/trace_pipe
<idle>-0 [000] d.h3 505.397558: nmi_handler: perf_event_nmi_handler() delta_ns: 3236765 handled: 1 <idle>-0 [000] d.h3 505.397558: nmi_handler: perf_event_nmi_handler() delta_ns: 3236765 handled: 1
<idle>-0 [000] d.h3 505.805893: nmi_handler: perf_event_nmi_handler() delta_ns: 3174234 handled: 1 <idle>-0 [000] d.h3 505.805893: nmi_handler: perf_event_nmi_handler() delta_ns: 3174234 handled: 1
<idle>-0 [000] d.h3 506.158206: nmi_handler: perf_event_nmi_handler() delta_ns: 3084642 handled: 1 <idle>-0 [000] d.h3 506.158206: nmi_handler: perf_event_nmi_handler() delta_ns: 3084642 handled: 1
......
...@@ -24,27 +24,27 @@ tracing information should be printed. ...@@ -24,27 +24,27 @@ tracing information should be printed.
--------------------------------- ---------------------------------
The events which are available for tracing can be found in the file The events which are available for tracing can be found in the file
/sys/kernel/debug/tracing/available_events. /sys/kernel/tracing/available_events.
To enable a particular event, such as 'sched_wakeup', simply echo it To enable a particular event, such as 'sched_wakeup', simply echo it
to /sys/kernel/debug/tracing/set_event. For example:: to /sys/kernel/tracing/set_event. For example::
# echo sched_wakeup >> /sys/kernel/debug/tracing/set_event # echo sched_wakeup >> /sys/kernel/tracing/set_event
.. Note:: '>>' is necessary, otherwise it will firstly disable all the events. .. Note:: '>>' is necessary, otherwise it will firstly disable all the events.
To disable an event, echo the event name to the set_event file prefixed To disable an event, echo the event name to the set_event file prefixed
with an exclamation point:: with an exclamation point::
# echo '!sched_wakeup' >> /sys/kernel/debug/tracing/set_event # echo '!sched_wakeup' >> /sys/kernel/tracing/set_event
To disable all events, echo an empty line to the set_event file:: To disable all events, echo an empty line to the set_event file::
# echo > /sys/kernel/debug/tracing/set_event # echo > /sys/kernel/tracing/set_event
To enable all events, echo ``*:*`` or ``*:`` to the set_event file:: To enable all events, echo ``*:*`` or ``*:`` to the set_event file::
# echo *:* > /sys/kernel/debug/tracing/set_event # echo *:* > /sys/kernel/tracing/set_event
The events are organized into subsystems, such as ext4, irq, sched, The events are organized into subsystems, such as ext4, irq, sched,
etc., and a full event name looks like this: <subsystem>:<event>. The etc., and a full event name looks like this: <subsystem>:<event>. The
...@@ -53,29 +53,29 @@ file. All of the events in a subsystem can be specified via the syntax ...@@ -53,29 +53,29 @@ file. All of the events in a subsystem can be specified via the syntax
``<subsystem>:*``; for example, to enable all irq events, you can use the ``<subsystem>:*``; for example, to enable all irq events, you can use the
command:: command::
# echo 'irq:*' > /sys/kernel/debug/tracing/set_event # echo 'irq:*' > /sys/kernel/tracing/set_event
2.2 Via the 'enable' toggle 2.2 Via the 'enable' toggle
--------------------------- ---------------------------
The events available are also listed in /sys/kernel/debug/tracing/events/ hierarchy The events available are also listed in /sys/kernel/tracing/events/ hierarchy
of directories. of directories.
To enable event 'sched_wakeup':: To enable event 'sched_wakeup'::
# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable # echo 1 > /sys/kernel/tracing/events/sched/sched_wakeup/enable
To disable it:: To disable it::
# echo 0 > /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable # echo 0 > /sys/kernel/tracing/events/sched/sched_wakeup/enable
To enable all events in sched subsystem:: To enable all events in sched subsystem::
# echo 1 > /sys/kernel/debug/tracing/events/sched/enable # echo 1 > /sys/kernel/tracing/events/sched/enable
To enable all events:: To enable all events::
# echo 1 > /sys/kernel/debug/tracing/events/enable # echo 1 > /sys/kernel/tracing/events/enable
When reading one of these enable files, there are four results: When reading one of these enable files, there are four results:
...@@ -126,7 +126,7 @@ is the size of the data item, in bytes. ...@@ -126,7 +126,7 @@ is the size of the data item, in bytes.
For example, here's the information displayed for the 'sched_wakeup' For example, here's the information displayed for the 'sched_wakeup'
event:: event::
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/format # cat /sys/kernel/tracing/events/sched/sched_wakeup/format
name: sched_wakeup name: sched_wakeup
ID: 60 ID: 60
...@@ -215,19 +215,19 @@ to the 'filter' file for the given event. ...@@ -215,19 +215,19 @@ to the 'filter' file for the given event.
For example:: For example::
# cd /sys/kernel/debug/tracing/events/sched/sched_wakeup # cd /sys/kernel/tracing/events/sched/sched_wakeup
# echo "common_preempt_count > 4" > filter # echo "common_preempt_count > 4" > filter
A slightly more involved example:: A slightly more involved example::
# cd /sys/kernel/debug/tracing/events/signal/signal_generate # cd /sys/kernel/tracing/events/signal/signal_generate
# echo "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter # echo "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter
If there is an error in the expression, you'll get an 'Invalid If there is an error in the expression, you'll get an 'Invalid
argument' error when setting it, and the erroneous string along with argument' error when setting it, and the erroneous string along with
an error message can be seen by looking at the filter e.g.:: an error message can be seen by looking at the filter e.g.::
# cd /sys/kernel/debug/tracing/events/signal/signal_generate # cd /sys/kernel/tracing/events/signal/signal_generate
# echo "((sig >= 10 && sig < 15) || dsig == 17) && comm != bash" > filter # echo "((sig >= 10 && sig < 15) || dsig == 17) && comm != bash" > filter
-bash: echo: write error: Invalid argument -bash: echo: write error: Invalid argument
# cat filter # cat filter
...@@ -277,7 +277,7 @@ above points: ...@@ -277,7 +277,7 @@ above points:
Clear the filters on all events in the sched subsystem:: Clear the filters on all events in the sched subsystem::
# cd /sys/kernel/debug/tracing/events/sched # cd /sys/kernel/tracing/events/sched
# echo 0 > filter # echo 0 > filter
# cat sched_switch/filter # cat sched_switch/filter
none none
...@@ -287,7 +287,7 @@ Clear the filters on all events in the sched subsystem:: ...@@ -287,7 +287,7 @@ Clear the filters on all events in the sched subsystem::
Set a filter using only common fields for all events in the sched Set a filter using only common fields for all events in the sched
subsystem (all events end up with the same filter):: subsystem (all events end up with the same filter)::
# cd /sys/kernel/debug/tracing/events/sched # cd /sys/kernel/tracing/events/sched
# echo common_pid == 0 > filter # echo common_pid == 0 > filter
# cat sched_switch/filter # cat sched_switch/filter
common_pid == 0 common_pid == 0
...@@ -298,7 +298,7 @@ Attempt to set a filter using a non-common field for all events in the ...@@ -298,7 +298,7 @@ Attempt to set a filter using a non-common field for all events in the
sched subsystem (all events but those that have a prev_pid field retain sched subsystem (all events but those that have a prev_pid field retain
their old filters):: their old filters)::
# cd /sys/kernel/debug/tracing/events/sched # cd /sys/kernel/tracing/events/sched
# echo prev_pid == 0 > filter # echo prev_pid == 0 > filter
# cat sched_switch/filter # cat sched_switch/filter
prev_pid == 0 prev_pid == 0
...@@ -313,7 +313,7 @@ exists, will filter all events from tracing any task that does not have the ...@@ -313,7 +313,7 @@ exists, will filter all events from tracing any task that does not have the
PID listed in the set_event_pid file. PID listed in the set_event_pid file.
:: ::
# cd /sys/kernel/debug/tracing # cd /sys/kernel/tracing
# echo $$ > set_event_pid # echo $$ > set_event_pid
# echo 1 > events/enable # echo 1 > events/enable
...@@ -409,14 +409,14 @@ The following commands are supported: ...@@ -409,14 +409,14 @@ The following commands are supported:
specifies that this enablement happens only once:: specifies that this enablement happens only once::
# echo 'enable_event:kmem:kmalloc:1' > \ # echo 'enable_event:kmem:kmalloc:1' > \
/sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger /sys/kernel/tracing/events/syscalls/sys_enter_read/trigger
The following trigger causes kmalloc events to stop being traced The following trigger causes kmalloc events to stop being traced
when a read system call exits. This disablement happens on every when a read system call exits. This disablement happens on every
read system call exit:: read system call exit::
# echo 'disable_event:kmem:kmalloc' > \ # echo 'disable_event:kmem:kmalloc' > \
/sys/kernel/debug/tracing/events/syscalls/sys_exit_read/trigger /sys/kernel/tracing/events/syscalls/sys_exit_read/trigger
The format is:: The format is::
...@@ -426,10 +426,10 @@ The following commands are supported: ...@@ -426,10 +426,10 @@ The following commands are supported:
To remove the above commands:: To remove the above commands::
# echo '!enable_event:kmem:kmalloc:1' > \ # echo '!enable_event:kmem:kmalloc:1' > \
/sys/kernel/debug/tracing/events/syscalls/sys_enter_read/trigger /sys/kernel/tracing/events/syscalls/sys_enter_read/trigger
# echo '!disable_event:kmem:kmalloc' > \ # echo '!disable_event:kmem:kmalloc' > \
/sys/kernel/debug/tracing/events/syscalls/sys_exit_read/trigger /sys/kernel/tracing/events/syscalls/sys_exit_read/trigger
Note that there can be any number of enable/disable_event triggers Note that there can be any number of enable/disable_event triggers
per triggering event, but there can only be one trigger per per triggering event, but there can only be one trigger per
...@@ -448,13 +448,13 @@ The following commands are supported: ...@@ -448,13 +448,13 @@ The following commands are supported:
kmalloc tracepoint is hit:: kmalloc tracepoint is hit::
# echo 'stacktrace' > \ # echo 'stacktrace' > \
/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger /sys/kernel/tracing/events/kmem/kmalloc/trigger
The following trigger dumps a stacktrace the first 5 times a kmalloc The following trigger dumps a stacktrace the first 5 times a kmalloc
request happens with a size >= 64K:: request happens with a size >= 64K::
# echo 'stacktrace:5 if bytes_req >= 65536' > \ # echo 'stacktrace:5 if bytes_req >= 65536' > \
/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger /sys/kernel/tracing/events/kmem/kmalloc/trigger
The format is:: The format is::
...@@ -463,16 +463,16 @@ The following commands are supported: ...@@ -463,16 +463,16 @@ The following commands are supported:
To remove the above commands:: To remove the above commands::
# echo '!stacktrace' > \ # echo '!stacktrace' > \
/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger /sys/kernel/tracing/events/kmem/kmalloc/trigger
# echo '!stacktrace:5 if bytes_req >= 65536' > \ # echo '!stacktrace:5 if bytes_req >= 65536' > \
/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger /sys/kernel/tracing/events/kmem/kmalloc/trigger
The latter can also be removed more simply by the following (without The latter can also be removed more simply by the following (without
the filter):: the filter)::
# echo '!stacktrace:5' > \ # echo '!stacktrace:5' > \
/sys/kernel/debug/tracing/events/kmem/kmalloc/trigger /sys/kernel/tracing/events/kmem/kmalloc/trigger
Note that there can be only one stacktrace trigger per triggering Note that there can be only one stacktrace trigger per triggering
event. event.
...@@ -488,20 +488,20 @@ The following commands are supported: ...@@ -488,20 +488,20 @@ The following commands are supported:
capture those events when the trigger event occurred:: capture those events when the trigger event occurred::
# echo 'snapshot if nr_rq > 1' > \ # echo 'snapshot if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
To only snapshot once:: To only snapshot once::
# echo 'snapshot:1 if nr_rq > 1' > \ # echo 'snapshot:1 if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
To remove the above commands:: To remove the above commands::
# echo '!snapshot if nr_rq > 1' > \ # echo '!snapshot if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
# echo '!snapshot:1 if nr_rq > 1' > \ # echo '!snapshot:1 if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
Note that there can be only one snapshot trigger per triggering Note that there can be only one snapshot trigger per triggering
event. event.
...@@ -519,20 +519,20 @@ The following commands are supported: ...@@ -519,20 +519,20 @@ The following commands are supported:
trigger event:: trigger event::
# echo 'traceoff:1 if nr_rq > 1' > \ # echo 'traceoff:1 if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
To always disable tracing when nr_rq > 1:: To always disable tracing when nr_rq > 1::
# echo 'traceoff if nr_rq > 1' > \ # echo 'traceoff if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
To remove the above commands:: To remove the above commands::
# echo '!traceoff:1 if nr_rq > 1' > \ # echo '!traceoff:1 if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
# echo '!traceoff if nr_rq > 1' > \ # echo '!traceoff if nr_rq > 1' > \
/sys/kernel/debug/tracing/events/block/block_unplug/trigger /sys/kernel/tracing/events/block/block_unplug/trigger
Note that there can be only one traceon or traceoff trigger per Note that there can be only one traceon or traceoff trigger per
triggering event. triggering event.
......
...@@ -830,10 +830,10 @@ Error conditions ...@@ -830,10 +830,10 @@ Error conditions
The extended error information and usage takes the form shown in The extended error information and usage takes the form shown in
this example:: this example::
# echo xxx > /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger # echo xxx > /sys/kernel/tracing/events/sched/sched_wakeup/trigger
echo: write error: Invalid argument echo: write error: Invalid argument
# cat /sys/kernel/debug/tracing/error_log # cat /sys/kernel/tracing/error_log
[ 5348.887237] location: error: Couldn't yyy: zzz [ 5348.887237] location: error: Couldn't yyy: zzz
Command: xxx Command: xxx
^ ^
...@@ -843,7 +843,7 @@ Error conditions ...@@ -843,7 +843,7 @@ Error conditions
To clear the error log, echo the empty string into it:: To clear the error log, echo the empty string into it::
# echo > /sys/kernel/debug/tracing/error_log # echo > /sys/kernel/tracing/error_log
Examples of using the tracer Examples of using the tracer
---------------------------- ----------------------------
......
...@@ -14,7 +14,7 @@ tracing_map.c. ...@@ -14,7 +14,7 @@ tracing_map.c.
Note: All the ftrace histogram command examples assume the working Note: All the ftrace histogram command examples assume the working
directory is the ftrace /tracing directory. For example:: directory is the ftrace /tracing directory. For example::
# cd /sys/kernel/debug/tracing # cd /sys/kernel/tracing
Also, the histogram output displayed for those commands will be Also, the histogram output displayed for those commands will be
generally be truncated - only enough to make the point is displayed. generally be truncated - only enough to make the point is displayed.
...@@ -905,7 +905,7 @@ means it will be automatically converted into a field variable:: ...@@ -905,7 +905,7 @@ means it will be automatically converted into a field variable::
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \ # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid)' >> onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid)' >>
/sys/kernel/debug/tracing/events/sched/sched_switch/trigger /sys/kernel/tracing/events/sched/sched_switch/trigger
The diagram for the sched_switch event is similar to previous examples The diagram for the sched_switch event is similar to previous examples
but shows the additional field_vars[] array for hist_data and shows but shows the additional field_vars[] array for hist_data and shows
...@@ -1112,7 +1112,7 @@ sched_switch event fields, next_pid and next_comm, to generate a ...@@ -1112,7 +1112,7 @@ sched_switch event fields, next_pid and next_comm, to generate a
wakeup_latency trace event. The next_pid and next_comm event fields wakeup_latency trace event. The next_pid and next_comm event fields
are automatically converted into field variables for this purpose:: are automatically converted into field variables for this purpose::
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/tracing/events/sched/sched_switch/trigger
The sched_waking hist_debug output shows the same data as in the The sched_waking hist_debug output shows the same data as in the
previous test example:: previous test example::
...@@ -1305,7 +1305,7 @@ and event name for the onmatch() handler:: ...@@ -1305,7 +1305,7 @@ and event name for the onmatch() handler::
The commands below can be used to clean things up for the next test:: The commands below can be used to clean things up for the next test::
# echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger # echo '!hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,next_comm)' >> /sys/kernel/tracing/events/sched/sched_switch/trigger
# echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger # echo '!hist:keys=pid:ts0=common_timestamp.usecs' >> events/sched/sched_waking/trigger
...@@ -1363,13 +1363,13 @@ with the save() and snapshot() actions. For example:: ...@@ -1363,13 +1363,13 @@ with the save() and snapshot() actions. For example::
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \ # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm)' >> onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm)' >>
/sys/kernel/debug/tracing/events/sched/sched_switch/trigger /sys/kernel/tracing/events/sched/sched_switch/trigger
or:: or::
# echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \ # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0: \
onmax($wakeup_lat).snapshot()' >> onmax($wakeup_lat).snapshot()' >>
/sys/kernel/debug/tracing/events/sched/sched_switch/trigger /sys/kernel/tracing/events/sched/sched_switch/trigger
save() action field variable test save() action field variable test
--------------------------------- ---------------------------------
......
This diff is collapsed.
...@@ -17,10 +17,10 @@ To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y. ...@@ -17,10 +17,10 @@ To enable this feature, build your kernel with CONFIG_KPROBE_EVENTS=y.
Similar to the event tracer, this doesn't need to be activated via Similar to the event tracer, this doesn't need to be activated via
current_tracer. Instead of that, add probe points via current_tracer. Instead of that, add probe points via
/sys/kernel/debug/tracing/kprobe_events, and enable it via /sys/kernel/tracing/kprobe_events, and enable it via
/sys/kernel/debug/tracing/events/kprobes/<EVENT>/enable. /sys/kernel/tracing/events/kprobes/<EVENT>/enable.
You can also use /sys/kernel/debug/tracing/dynamic_events instead of You can also use /sys/kernel/tracing/dynamic_events instead of
kprobe_events. That interface will provide unified access to other kprobe_events. That interface will provide unified access to other
dynamic events too. dynamic events too.
...@@ -153,7 +153,7 @@ trigger: ...@@ -153,7 +153,7 @@ trigger:
Event Profiling Event Profiling
--------------- ---------------
You can check the total number of probe hits and probe miss-hits via You can check the total number of probe hits and probe miss-hits via
/sys/kernel/debug/tracing/kprobe_profile. /sys/kernel/tracing/kprobe_profile.
The first column is event name, the second is the number of probe hits, The first column is event name, the second is the number of probe hits,
the third is the number of probe miss-hits. the third is the number of probe miss-hits.
...@@ -177,7 +177,7 @@ Usage examples ...@@ -177,7 +177,7 @@ Usage examples
To add a probe as a new event, write a new definition to kprobe_events To add a probe as a new event, write a new definition to kprobe_events
as below:: as below::
echo 'p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)' > /sys/kernel/debug/tracing/kprobe_events echo 'p:myprobe do_sys_open dfd=%ax filename=%dx flags=%cx mode=+4($stack)' > /sys/kernel/tracing/kprobe_events
This sets a kprobe on the top of do_sys_open() function with recording This sets a kprobe on the top of do_sys_open() function with recording
1st to 4th arguments as "myprobe" event. Note, which register/stack entry is 1st to 4th arguments as "myprobe" event. Note, which register/stack entry is
...@@ -187,15 +187,15 @@ under tools/perf/). ...@@ -187,15 +187,15 @@ under tools/perf/).
As this example shows, users can choose more familiar names for each arguments. As this example shows, users can choose more familiar names for each arguments.
:: ::
echo 'r:myretprobe do_sys_open $retval' >> /sys/kernel/debug/tracing/kprobe_events echo 'r:myretprobe do_sys_open $retval' >> /sys/kernel/tracing/kprobe_events
This sets a kretprobe on the return point of do_sys_open() function with This sets a kretprobe on the return point of do_sys_open() function with
recording return value as "myretprobe" event. recording return value as "myretprobe" event.
You can see the format of these events via You can see the format of these events via
/sys/kernel/debug/tracing/events/kprobes/<EVENT>/format. /sys/kernel/tracing/events/kprobes/<EVENT>/format.
:: ::
cat /sys/kernel/debug/tracing/events/kprobes/myprobe/format cat /sys/kernel/tracing/events/kprobes/myprobe/format
name: myprobe name: myprobe
ID: 780 ID: 780
format: format:
...@@ -218,7 +218,7 @@ You can see the format of these events via ...@@ -218,7 +218,7 @@ You can see the format of these events via
You can see that the event has 4 arguments as in the expressions you specified. You can see that the event has 4 arguments as in the expressions you specified.
:: ::
echo > /sys/kernel/debug/tracing/kprobe_events echo > /sys/kernel/tracing/kprobe_events
This clears all probe points. This clears all probe points.
...@@ -233,8 +233,8 @@ Right after definition, each event is disabled by default. For tracing these ...@@ -233,8 +233,8 @@ Right after definition, each event is disabled by default. For tracing these
events, you need to enable it. events, you need to enable it.
:: ::
echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable echo 1 > /sys/kernel/tracing/events/kprobes/myprobe/enable
echo 1 > /sys/kernel/debug/tracing/events/kprobes/myretprobe/enable echo 1 > /sys/kernel/tracing/events/kprobes/myretprobe/enable
Use the following command to start tracing in an interval. Use the following command to start tracing in an interval.
:: ::
...@@ -243,10 +243,10 @@ Use the following command to start tracing in an interval. ...@@ -243,10 +243,10 @@ Use the following command to start tracing in an interval.
Open something... Open something...
# echo 0 > tracing_on # echo 0 > tracing_on
And you can see the traced information via /sys/kernel/debug/tracing/trace. And you can see the traced information via /sys/kernel/tracing/trace.
:: ::
cat /sys/kernel/debug/tracing/trace cat /sys/kernel/tracing/trace
# tracer: nop # tracer: nop
# #
# TASK-PID CPU# TIMESTAMP FUNCTION # TASK-PID CPU# TIMESTAMP FUNCTION
......
...@@ -36,11 +36,11 @@ Usage Quick Reference ...@@ -36,11 +36,11 @@ Usage Quick Reference
:: ::
$ mount -t debugfs debugfs /sys/kernel/debug $ mount -t debugfs debugfs /sys/kernel/debug
$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer $ echo mmiotrace > /sys/kernel/tracing/current_tracer
$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & $ cat /sys/kernel/tracing/trace_pipe > mydump.txt &
Start X or whatever. Start X or whatever.
$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker $ echo "X is up" > /sys/kernel/tracing/trace_marker
$ echo nop > /sys/kernel/debug/tracing/current_tracer $ echo nop > /sys/kernel/tracing/current_tracer
Check for lost events. Check for lost events.
...@@ -56,11 +56,11 @@ Check that the driver you are about to trace is not loaded. ...@@ -56,11 +56,11 @@ Check that the driver you are about to trace is not loaded.
Activate mmiotrace (requires root privileges):: Activate mmiotrace (requires root privileges)::
$ echo mmiotrace > /sys/kernel/debug/tracing/current_tracer $ echo mmiotrace > /sys/kernel/tracing/current_tracer
Start storing the trace:: Start storing the trace::
$ cat /sys/kernel/debug/tracing/trace_pipe > mydump.txt & $ cat /sys/kernel/tracing/trace_pipe > mydump.txt &
The 'cat' process should stay running (sleeping) in the background. The 'cat' process should stay running (sleeping) in the background.
...@@ -68,14 +68,14 @@ Load the driver you want to trace and use it. Mmiotrace will only catch MMIO ...@@ -68,14 +68,14 @@ Load the driver you want to trace and use it. Mmiotrace will only catch MMIO
accesses to areas that are ioremapped while mmiotrace is active. accesses to areas that are ioremapped while mmiotrace is active.
During tracing you can place comments (markers) into the trace by During tracing you can place comments (markers) into the trace by
$ echo "X is up" > /sys/kernel/debug/tracing/trace_marker $ echo "X is up" > /sys/kernel/tracing/trace_marker
This makes it easier to see which part of the (huge) trace corresponds to This makes it easier to see which part of the (huge) trace corresponds to
which action. It is recommended to place descriptive markers about what you which action. It is recommended to place descriptive markers about what you
do. do.
Shut down mmiotrace (requires root privileges):: Shut down mmiotrace (requires root privileges)::
$ echo nop > /sys/kernel/debug/tracing/current_tracer $ echo nop > /sys/kernel/tracing/current_tracer
The 'cat' process exits. If it does not, kill it by issuing 'fg' command and The 'cat' process exits. If it does not, kill it by issuing 'fg' command and
pressing ctrl+c. pressing ctrl+c.
...@@ -93,12 +93,12 @@ events were lost, the trace is incomplete. You should enlarge the buffers and ...@@ -93,12 +93,12 @@ events were lost, the trace is incomplete. You should enlarge the buffers and
try again. Buffers are enlarged by first seeing how large the current buffers try again. Buffers are enlarged by first seeing how large the current buffers
are:: are::
$ cat /sys/kernel/debug/tracing/buffer_size_kb $ cat /sys/kernel/tracing/buffer_size_kb
gives you a number. Approximately double this number and write it back, for gives you a number. Approximately double this number and write it back, for
instance:: instance::
$ echo 128000 > /sys/kernel/debug/tracing/buffer_size_kb $ echo 128000 > /sys/kernel/tracing/buffer_size_kb
Then start again from the top. Then start again from the top.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# to extract some high-level information on what is going on. The accuracy of the parser # to extract some high-level information on what is going on. The accuracy of the parser
# may vary considerably # may vary considerably
# #
# Example usage: trace-pagealloc-postprocess.pl < /sys/kernel/debug/tracing/trace_pipe # Example usage: trace-pagealloc-postprocess.pl < /sys/kernel/tracing/trace_pipe
# other options # other options
# --prepend-parent Report on the parent proc and PID # --prepend-parent Report on the parent proc and PID
# --read-procstat If the trace lacks process info, get it from /proc # --read-procstat If the trace lacks process info, get it from /proc
...@@ -94,7 +94,7 @@ sub generate_traceevent_regex { ...@@ -94,7 +94,7 @@ sub generate_traceevent_regex {
my $regex; my $regex;
# Read the event format or use the default # Read the event format or use the default
if (!open (FORMAT, "/sys/kernel/debug/tracing/events/$event/format")) { if (!open (FORMAT, "/sys/kernel/tracing/events/$event/format")) {
$regex = $default; $regex = $default;
} else { } else {
my $line; my $line;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# page reclaim. It makes an attempt to extract some high-level information on # page reclaim. It makes an attempt to extract some high-level information on
# what is going on. The accuracy of the parser may vary # what is going on. The accuracy of the parser may vary
# #
# Example usage: trace-vmscan-postprocess.pl < /sys/kernel/debug/tracing/trace_pipe # Example usage: trace-vmscan-postprocess.pl < /sys/kernel/tracing/trace_pipe
# other options # other options
# --read-procstat If the trace lacks process info, get it from /proc # --read-procstat If the trace lacks process info, get it from /proc
# --ignore-pid Aggregate processes of the same name together # --ignore-pid Aggregate processes of the same name together
...@@ -140,7 +140,7 @@ sub generate_traceevent_regex { ...@@ -140,7 +140,7 @@ sub generate_traceevent_regex {
my $regex; my $regex;
# Read the event format or use the default # Read the event format or use the default
if (!open (FORMAT, "/sys/kernel/debug/tracing/events/$event/format")) { if (!open (FORMAT, "/sys/kernel/tracing/events/$event/format")) {
print("WARNING: Event $event format string not found\n"); print("WARNING: Event $event format string not found\n");
return $default; return $default;
} else { } else {
......
...@@ -26,10 +26,10 @@ assumed that the PCL tool tools/perf has been installed and is in your path. ...@@ -26,10 +26,10 @@ assumed that the PCL tool tools/perf has been installed and is in your path.
2.1 Standard Utilities 2.1 Standard Utilities
---------------------- ----------------------
All possible events are visible from /sys/kernel/debug/tracing/events. Simply All possible events are visible from /sys/kernel/tracing/events. Simply
calling:: calling::
$ find /sys/kernel/debug/tracing/events -type d $ find /sys/kernel/tracing/events -type d
will give a fair indication of the number of events available. will give a fair indication of the number of events available.
...@@ -59,7 +59,7 @@ See Documentation/trace/events.rst for a proper description on how events ...@@ -59,7 +59,7 @@ See Documentation/trace/events.rst for a proper description on how events
can be enabled system-wide. A short example of enabling all events related can be enabled system-wide. A short example of enabling all events related
to page allocation would look something like:: to page allocation would look something like::
$ for i in `find /sys/kernel/debug/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done $ for i in `find /sys/kernel/tracing/events -name "enable" | grep mm_`; do echo 1 > $i; done
3.2 System-Wide Event Enabling with SystemTap 3.2 System-Wide Event Enabling with SystemTap
--------------------------------------------- ---------------------------------------------
...@@ -189,7 +189,7 @@ time on a system-wide basis using -a and sleep. ...@@ -189,7 +189,7 @@ time on a system-wide basis using -a and sleep.
============================================ ============================================
When events are enabled the events that are triggering can be read from When events are enabled the events that are triggering can be read from
/sys/kernel/debug/tracing/trace_pipe in human-readable format although binary /sys/kernel/tracing/trace_pipe in human-readable format although binary
options exist as well. By post-processing the output, further information can options exist as well. By post-processing the output, further information can
be gathered on-line as appropriate. Examples of post-processing might include be gathered on-line as appropriate. Examples of post-processing might include
......
...@@ -12,13 +12,13 @@ To enable this feature, build your kernel with CONFIG_UPROBE_EVENTS=y. ...@@ -12,13 +12,13 @@ To enable this feature, build your kernel with CONFIG_UPROBE_EVENTS=y.
Similar to the kprobe-event tracer, this doesn't need to be activated via Similar to the kprobe-event tracer, this doesn't need to be activated via
current_tracer. Instead of that, add probe points via current_tracer. Instead of that, add probe points via
/sys/kernel/debug/tracing/uprobe_events, and enable it via /sys/kernel/tracing/uprobe_events, and enable it via
/sys/kernel/debug/tracing/events/uprobes/<EVENT>/enable. /sys/kernel/tracing/events/uprobes/<EVENT>/enable.
However unlike kprobe-event tracer, the uprobe event interface expects the However unlike kprobe-event tracer, the uprobe event interface expects the
user to calculate the offset of the probepoint in the object. user to calculate the offset of the probepoint in the object.
You can also use /sys/kernel/debug/tracing/dynamic_events instead of You can also use /sys/kernel/tracing/dynamic_events instead of
uprobe_events. That interface will provide unified access to other uprobe_events. That interface will provide unified access to other
dynamic events too. dynamic events too.
...@@ -79,7 +79,7 @@ For $comm, the default type is "string"; any other type is invalid. ...@@ -79,7 +79,7 @@ For $comm, the default type is "string"; any other type is invalid.
Event Profiling Event Profiling
--------------- ---------------
You can check the total number of probe hits per event via You can check the total number of probe hits per event via
/sys/kernel/debug/tracing/uprobe_profile. The first column is the filename, /sys/kernel/tracing/uprobe_profile. The first column is the filename,
the second is the event name, the third is the number of probe hits. the second is the event name, the third is the number of probe hits.
Usage examples Usage examples
...@@ -87,28 +87,28 @@ Usage examples ...@@ -87,28 +87,28 @@ Usage examples
* Add a probe as a new uprobe event, write a new definition to uprobe_events * Add a probe as a new uprobe event, write a new definition to uprobe_events
as below (sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash):: as below (sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash)::
echo 'p /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events echo 'p /bin/bash:0x4245c0' > /sys/kernel/tracing/uprobe_events
* Add a probe as a new uretprobe event:: * Add a probe as a new uretprobe event::
echo 'r /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events echo 'r /bin/bash:0x4245c0' > /sys/kernel/tracing/uprobe_events
* Unset registered event:: * Unset registered event::
echo '-:p_bash_0x4245c0' >> /sys/kernel/debug/tracing/uprobe_events echo '-:p_bash_0x4245c0' >> /sys/kernel/tracing/uprobe_events
* Print out the events that are registered:: * Print out the events that are registered::
cat /sys/kernel/debug/tracing/uprobe_events cat /sys/kernel/tracing/uprobe_events
* Clear all events:: * Clear all events::
echo > /sys/kernel/debug/tracing/uprobe_events echo > /sys/kernel/tracing/uprobe_events
Following example shows how to dump the instruction pointer and %ax register Following example shows how to dump the instruction pointer and %ax register
at the probed text address. Probe zfree function in /bin/zsh:: at the probed text address. Probe zfree function in /bin/zsh::
# cd /sys/kernel/debug/tracing/ # cd /sys/kernel/tracing/
# cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp # cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp
00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh 00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh
# objdump -T /bin/zsh | grep -w zfree # objdump -T /bin/zsh | grep -w zfree
...@@ -168,7 +168,7 @@ Also, you can disable the event by:: ...@@ -168,7 +168,7 @@ Also, you can disable the event by::
# echo 0 > events/uprobes/enable # echo 0 > events/uprobes/enable
And you can see the traced information via /sys/kernel/debug/tracing/trace. And you can see the traced information via /sys/kernel/tracing/trace.
:: ::
# cat trace # cat trace
......
...@@ -11,10 +11,10 @@ that can be viewed via existing tools, such as ftrace and perf. ...@@ -11,10 +11,10 @@ that can be viewed via existing tools, such as ftrace and perf.
To enable this feature, build your kernel with CONFIG_USER_EVENTS=y. To enable this feature, build your kernel with CONFIG_USER_EVENTS=y.
Programs can view status of the events via Programs can view status of the events via
/sys/kernel/debug/tracing/user_events_status and can both register and write /sys/kernel/tracing/user_events_status and can both register and write
data out via /sys/kernel/debug/tracing/user_events_data. data out via /sys/kernel/tracing/user_events_data.
Programs can also use /sys/kernel/debug/tracing/dynamic_events to register and Programs can also use /sys/kernel/tracing/dynamic_events to register and
delete user based events via the u: prefix. The format of the command to delete user based events via the u: prefix. The format of the command to
dynamic_events is the same as the ioctl with the u: prefix applied. dynamic_events is the same as the ioctl with the u: prefix applied.
...@@ -22,9 +22,9 @@ Typically programs will register a set of events that they wish to expose to ...@@ -22,9 +22,9 @@ Typically programs will register a set of events that they wish to expose to
tools that can read trace_events (such as ftrace and perf). The registration tools that can read trace_events (such as ftrace and perf). The registration
process gives back two ints to the program for each event. The first int is process gives back two ints to the program for each event. The first int is
the status bit. This describes which bit in little-endian format in the the status bit. This describes which bit in little-endian format in the
/sys/kernel/debug/tracing/user_events_status file represents this event. The /sys/kernel/tracing/user_events_status file represents this event. The
second int is the write index which describes the data when a write() or second int is the write index which describes the data when a write() or
writev() is called on the /sys/kernel/debug/tracing/user_events_data file. writev() is called on the /sys/kernel/tracing/user_events_data file.
The structures referenced in this document are contained within the The structures referenced in this document are contained within the
/include/uapi/linux/user_events.h file in the source tree. /include/uapi/linux/user_events.h file in the source tree.
...@@ -35,7 +35,7 @@ filesystem and may be mounted at different paths than above.* ...@@ -35,7 +35,7 @@ filesystem and may be mounted at different paths than above.*
Registering Registering
----------- -----------
Registering within a user process is done via ioctl() out to the Registering within a user process is done via ioctl() out to the
/sys/kernel/debug/tracing/user_events_data file. The command to issue is /sys/kernel/tracing/user_events_data file. The command to issue is
DIAG_IOCSREG. DIAG_IOCSREG.
This command takes a packed struct user_reg as an argument:: This command takes a packed struct user_reg as an argument::
...@@ -54,7 +54,7 @@ and the write index. ...@@ -54,7 +54,7 @@ and the write index.
User based events show up under tracefs like any other event under the User based events show up under tracefs like any other event under the
subsystem named "user_events". This means tools that wish to attach to the subsystem named "user_events". This means tools that wish to attach to the
events need to use /sys/kernel/debug/tracing/events/user_events/[name]/enable events need to use /sys/kernel/tracing/events/user_events/[name]/enable
or perf record -e user_events:[name] when attaching/recording. or perf record -e user_events:[name] when attaching/recording.
**NOTE:** *The write_index returned is only valid for the FD that was used* **NOTE:** *The write_index returned is only valid for the FD that was used*
...@@ -96,7 +96,7 @@ Would be represented by the following field:: ...@@ -96,7 +96,7 @@ Would be represented by the following field::
Deleting Deleting
----------- -----------
Deleting an event from within a user process is done via ioctl() out to the Deleting an event from within a user process is done via ioctl() out to the
/sys/kernel/debug/tracing/user_events_data file. The command to issue is /sys/kernel/tracing/user_events_data file. The command to issue is
DIAG_IOCSDEL. DIAG_IOCSDEL.
This command only requires a single string specifying the event to delete by This command only requires a single string specifying the event to delete by
...@@ -110,7 +110,7 @@ When tools attach/record user based events the status of the event is updated ...@@ -110,7 +110,7 @@ When tools attach/record user based events the status of the event is updated
in realtime. This allows user programs to only incur the cost of the write() or in realtime. This allows user programs to only incur the cost of the write() or
writev() calls when something is actively attached to the event. writev() calls when something is actively attached to the event.
User programs call mmap() on /sys/kernel/debug/tracing/user_events_status to User programs call mmap() on /sys/kernel/tracing/user_events_status to
check the status for each event that is registered. The bit to check in the check the status for each event that is registered. The bit to check in the
file is given back after the register ioctl() via user_reg.status_bit. The bit file is given back after the register ioctl() via user_reg.status_bit. The bit
is always in little-endian format. Programs can check if the bit is set either is always in little-endian format. Programs can check if the bit is set either
......
...@@ -313,8 +313,8 @@ And with cmwq with ``@max_active`` >= 3, :: ...@@ -313,8 +313,8 @@ And with cmwq with ``@max_active`` >= 3, ::
第一个可以用追踪的方式进行跟踪: :: 第一个可以用追踪的方式进行跟踪: ::
$ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event $ echo workqueue:workqueue_queue_work > /sys/kernel/tracing/set_event
$ cat /sys/kernel/debug/tracing/trace_pipe > out.txt $ cat /sys/kernel/tracing/trace_pipe > out.txt
(wait a few secs) (wait a few secs)
如果有什么东西在工作队列上忙着做循环,它就会主导输出,可以用工作项函数确定违规者。 如果有什么东西在工作队列上忙着做循环,它就会主导输出,可以用工作项函数确定违规者。
......
...@@ -608,12 +608,12 @@ how we can measure the latency in cycles of reading from this region and ...@@ -608,12 +608,12 @@ how we can measure the latency in cycles of reading from this region and
visualize this data with a histogram that is available if CONFIG_HIST_TRIGGERS visualize this data with a histogram that is available if CONFIG_HIST_TRIGGERS
is set:: is set::
# :> /sys/kernel/debug/tracing/trace # :> /sys/kernel/tracing/trace
# echo 'hist:keys=latency' > /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_mem_latency/trigger # echo 'hist:keys=latency' > /sys/kernel/tracing/events/resctrl/pseudo_lock_mem_latency/trigger
# echo 1 > /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_mem_latency/enable # echo 1 > /sys/kernel/tracing/events/resctrl/pseudo_lock_mem_latency/enable
# echo 1 > /sys/kernel/debug/resctrl/newlock/pseudo_lock_measure # echo 1 > /sys/kernel/debug/resctrl/newlock/pseudo_lock_measure
# echo 0 > /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_mem_latency/enable # echo 0 > /sys/kernel/tracing/events/resctrl/pseudo_lock_mem_latency/enable
# cat /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_mem_latency/hist # cat /sys/kernel/tracing/events/resctrl/pseudo_lock_mem_latency/hist
# event histogram # event histogram
# #
...@@ -642,11 +642,11 @@ cache of a platform. Here is how we can obtain details of the cache hits ...@@ -642,11 +642,11 @@ cache of a platform. Here is how we can obtain details of the cache hits
and misses using the platform's precision counters. and misses using the platform's precision counters.
:: ::
# :> /sys/kernel/debug/tracing/trace # :> /sys/kernel/tracing/trace
# echo 1 > /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_l2/enable # echo 1 > /sys/kernel/tracing/events/resctrl/pseudo_lock_l2/enable
# echo 2 > /sys/kernel/debug/resctrl/newlock/pseudo_lock_measure # echo 2 > /sys/kernel/debug/resctrl/newlock/pseudo_lock_measure
# echo 0 > /sys/kernel/debug/tracing/events/resctrl/pseudo_lock_l2/enable # echo 0 > /sys/kernel/tracing/events/resctrl/pseudo_lock_l2/enable
# cat /sys/kernel/debug/tracing/trace # cat /sys/kernel/tracing/trace
# tracer: nop # tracer: nop
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment