mirror of
https://github.com/brendangregg/perf-tools.git
synced 2025-12-01 07:26:04 +07:00
reset-ftrace files
This commit is contained in:
76
examples/reset-ftrace_example.txt
Normal file
76
examples/reset-ftrace_example.txt
Normal file
@@ -0,0 +1,76 @@
|
||||
Demonstrations of reset-ftrace, the Linux ftrace tool.
|
||||
|
||||
You will probably never need this tool. If you kill -9 an ftrace-based tool,
|
||||
leaving the kernel in a tracing enabled state, you could try using this tool
|
||||
to reset ftrace and disable tracing. Make sure no other ftrace sessions are
|
||||
in use on your system, or it will kill those.
|
||||
|
||||
Here's an example:
|
||||
|
||||
# ./opensnoop
|
||||
Tracing open()s. Ctrl-C to end.
|
||||
ERROR: ftrace may be in use by PID 2197 /var/tmp/.ftrace-lock
|
||||
|
||||
I tried to run opensnoop, but there's a lock file for PID 2197. Checking if it
|
||||
exists:
|
||||
|
||||
# ps -fp 2197
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
#
|
||||
|
||||
No.
|
||||
|
||||
I also know that no one is using ftrace on this system. So I'll use reset-ftrace
|
||||
to clean up this lock file and ftrace state:
|
||||
|
||||
# ./reset-ftrace
|
||||
ERROR: ftrace lock (/var/tmp/.ftrace-lock) exists. It shows ftrace may be in use by PID 2197.
|
||||
Double check to see if that PID is still active. If not, consider using -f to force a reset. Exiting.
|
||||
|
||||
... except it's complaining about the lock file too. I'm already sure that this
|
||||
PID doesn't exist, so I'll add the -f option:
|
||||
|
||||
# ./reset-ftrace -f
|
||||
Reseting ftrace state...
|
||||
|
||||
current_tracer, before:
|
||||
1 nop
|
||||
current_tracer, after:
|
||||
1 nop
|
||||
|
||||
set_ftrace_filter, before:
|
||||
1 #### all functions enabled ####
|
||||
set_ftrace_filter, after:
|
||||
1 #### all functions enabled ####
|
||||
|
||||
set_ftrace_pid, before:
|
||||
1 no pid
|
||||
set_ftrace_pid, after:
|
||||
1 no pid
|
||||
|
||||
kprobe_events, before:
|
||||
kprobe_events, after:
|
||||
|
||||
Done.
|
||||
|
||||
The output shows what has been reset, including the before and after state of
|
||||
these files.
|
||||
|
||||
Now I can try iosnoop again:
|
||||
|
||||
# ./iosnoop
|
||||
Tracing block I/O. Ctrl-C to end.
|
||||
COMM PID TYPE DEV BLOCK BYTES LATms
|
||||
supervise 1689 W 202,1 17039664 4096 0.58
|
||||
supervise 1689 W 202,1 17039672 4096 0.47
|
||||
supervise 1694 W 202,1 17039744 4096 0.98
|
||||
supervise 1694 W 202,1 17039752 4096 0.74
|
||||
supervise 1684 W 202,1 17039760 4096 0.63
|
||||
[...]
|
||||
|
||||
Fixed.
|
||||
|
||||
Note that reset-ftrace currently only resets a few methods of enabling
|
||||
tracing, such as set_ftrace_filter and kprobe_events. Static tracepoints could
|
||||
be enabled individually, and this script currently doesn't find and disable
|
||||
those.
|
||||
49
man/man8/reset-ftrace.8
Normal file
49
man/man8/reset-ftrace.8
Normal file
@@ -0,0 +1,49 @@
|
||||
.TH reset-ftrace 8 "2014-07-07" "USER COMMANDS"
|
||||
.SH NAME
|
||||
reset-ftrace \- reset state of ftrace, disabling all tracing. Written for Linux ftrace.
|
||||
.SH SYNOPSIS
|
||||
.B reset-ftrace
|
||||
[\-fhq]
|
||||
.SH DESCRIPTION
|
||||
This resets the state of various ftrace files, and shows the before and after
|
||||
state.
|
||||
|
||||
This may only be of use to ftrace hackers who, in the process of developing
|
||||
ftrace software, often get the subsystem into a partially active state, and
|
||||
would like a quick way to reset state. Check the end of this script for the
|
||||
actually files reset, and add more if you need.
|
||||
|
||||
WARNING: Only use this if and when you are sure that there are no other active
|
||||
ftrace sessions on your system, as otherwise it will kill them.
|
||||
.SH REQUIREMENTS
|
||||
FTRACE CONFIG.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\-f
|
||||
Force. If the ftrace lock file exists (/var/tmp/.ftrace-lock), delete it.
|
||||
.TP
|
||||
\-h
|
||||
Print usage message.
|
||||
.TP
|
||||
\-q
|
||||
Quiet. Run, but don't print any output.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Reset various ftrace files:
|
||||
#
|
||||
.B reset-ftrace
|
||||
.SH SOURCE
|
||||
This is from the perf-tools collection.
|
||||
.IP
|
||||
https://github.com/brendangregg/perf-tools
|
||||
.PP
|
||||
Also look under the examples directory for a text file containing example
|
||||
usage, output, and commentary for this tool.
|
||||
.SH OS
|
||||
Linux
|
||||
.SH STABILITY
|
||||
Unstable - in development.
|
||||
.SH AUTHOR
|
||||
Brendan Gregg
|
||||
.SH SEE ALSO
|
||||
perf(1)
|
||||
@@ -6,7 +6,7 @@
|
||||
# This may only be of use to ftrace hackers who, in the process of developing
|
||||
# ftrace software, often get the subsystem into a partially active state, and
|
||||
# would like a quick way to reset state. Check the end of this script for the
|
||||
# actualy files reset, and add more if you need.
|
||||
# actually files reset, and add more if you need.
|
||||
#
|
||||
# USAGE: ./reset-ftrace [-fhq]
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user