tools: rename "deadlock_detector" to "deadlock" (#2152) (#2160)
This renames the `deadlock_detector.py` tool to `deadlock.py` to make
the name more diagram-friendly and to be consistent with the naming of the
other tools.
diff --git a/tools/deadlock_detector.c b/tools/deadlock.c
similarity index 97%
rename from tools/deadlock_detector.c
rename to tools/deadlock.c
index 09899b0..e1f9b82 100644
--- a/tools/deadlock_detector.c
+++ b/tools/deadlock.c
@@ -1,6 +1,6 @@
/*
- * deadlock_detector.c Detects potential deadlocks in a running process.
- * For Linux, uses BCC, eBPF. See .py file.
+ * deadlock.c Detects potential deadlocks in a running process.
+ * For Linux, uses BCC, eBPF. See .py file.
*
* Copyright 2017 Facebook, Inc.
* Licensed under the Apache License, Version 2.0 (the "License")
diff --git a/tools/deadlock_detector.py b/tools/deadlock.py
similarity index 95%
rename from tools/deadlock_detector.py
rename to tools/deadlock.py
index 573f830..1784872 100755
--- a/tools/deadlock_detector.py
+++ b/tools/deadlock.py
@@ -1,12 +1,12 @@
#!/usr/bin/python
#
-# deadlock_detector Detects potential deadlocks (lock order inversions)
-# on a running process. For Linux, uses BCC, eBPF.
+# deadlock Detects potential deadlocks (lock order inversions)
+# on a running process. For Linux, uses BCC, eBPF.
#
-# USAGE: deadlock_detector.py [-h] [--binary BINARY] [--dump-graph DUMP_GRAPH]
-# [--verbose] [--lock-symbols LOCK_SYMBOLS]
-# [--unlock-symbols UNLOCK_SYMBOLS]
-# pid
+# USAGE: deadlock.py [-h] [--binary BINARY] [--dump-graph DUMP_GRAPH]
+# [--verbose] [--lock-symbols LOCK_SYMBOLS]
+# [--unlock-symbols UNLOCK_SYMBOLS]
+# pid
#
# This traces pthread mutex lock and unlock calls to build a directed graph
# representing the mutex wait graph:
@@ -388,25 +388,25 @@
def main():
examples = '''Examples:
- deadlock_detector 181 # Analyze PID 181
+ deadlock 181 # Analyze PID 181
- deadlock_detector 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
+ deadlock 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
# Analyze PID 181 and locks from this binary.
# If tracing a process that is running from
# a dynamically-linked binary, this argument
# is required and should be the path to the
# pthread library.
- deadlock_detector 181 --verbose
+ deadlock 181 --verbose
# Analyze PID 181 and print statistics about
# the mutex wait graph.
- deadlock_detector 181 --lock-symbols my_mutex_lock1,my_mutex_lock2 \\
+ deadlock 181 --lock-symbols my_mutex_lock1,my_mutex_lock2 \\
--unlock-symbols my_mutex_unlock1,my_mutex_unlock2
# Analyze PID 181 and trace custom mutex
# symbols instead of pthread mutexes.
- deadlock_detector 181 --dump-graph graph.json
+ deadlock 181 --dump-graph graph.json
# Analyze PID 181 and dump the mutex wait
# graph to graph.json.
'''
@@ -465,7 +465,7 @@
print('%s. Is the process (pid=%d) running?' % (str(e), args.pid))
sys.exit(1)
- bpf = BPF(src_file=b'deadlock_detector.c')
+ bpf = BPF(src_file=b'deadlock.c')
# Trace where threads are created
bpf.attach_kretprobe(event=bpf.get_syscall_fnname('clone'), fn_name='trace_clone')
diff --git a/tools/deadlock_detector_example.txt b/tools/deadlock_example.txt
similarity index 93%
rename from tools/deadlock_detector_example.txt
rename to tools/deadlock_example.txt
index 6cd2395..45d8126 100644
--- a/tools/deadlock_detector_example.txt
+++ b/tools/deadlock_example.txt
@@ -1,4 +1,4 @@
-Demonstrations of deadlock_detector.
+Demonstrations of deadlock.
This program detects potential deadlocks on a running process. The program
attaches uprobes on `pthread_mutex_lock` and `pthread_mutex_unlock` to build
@@ -35,7 +35,7 @@
potential deadlocks that involve only one mutex.
-# ./deadlock_detector.py 181
+# ./deadlock.py 181
Tracing... Hit Ctrl-C to end.
----------------
Potential Deadlock Detected!
@@ -239,7 +239,7 @@
(https://github.com/google/sanitizers/wiki/ThreadSanitizerDeadlockDetector).
-# ./deadlock_detector.py 181 --binary /usr/local/bin/lockinversion
+# ./deadlock.py 181 --binary /usr/local/bin/lockinversion
Tracing... Hit Ctrl-C to end.
^C
@@ -253,7 +253,7 @@
to the binary, and provide the symlink name instead to the `--binary` option.
-# ./deadlock_detector.py 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
+# ./deadlock.py 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
Tracing... Hit Ctrl-C to end.
^C
@@ -263,7 +263,7 @@
library used by the executable.
-# ./deadlock_detector.py 181 --dump-graph graph.json --verbose
+# ./deadlock.py 181 --dump-graph graph.json --verbose
Tracing... Hit Ctrl-C to end.
Mutexes: 0, Edges: 0
@@ -284,7 +284,7 @@
flag, and the program will serialize the graph in json.
-# ./deadlock_detector.py 181 --lock-symbols custom_mutex1_lock,custom_mutex2_lock --unlock_symbols custom_mutex1_unlock,custom_mutex2_unlock --verbose
+# ./deadlock.py 181 --lock-symbols custom_mutex1_lock,custom_mutex2_lock --unlock_symbols custom_mutex1_unlock,custom_mutex2_unlock --verbose
Tracing... Hit Ctrl-C to end.
Mutexes: 0, Edges: 0
@@ -307,12 +307,12 @@
USAGE message:
-# ./deadlock_detector.py -h
+# ./deadlock.py -h
-usage: deadlock_detector.py [-h] [--binary BINARY] [--dump-graph DUMP_GRAPH]
- [--verbose] [--lock-symbols LOCK_SYMBOLS]
- [--unlock-symbols UNLOCK_SYMBOLS]
- pid
+usage: deadlock.py [-h] [--binary BINARY] [--dump-graph DUMP_GRAPH]
+ [--verbose] [--lock-symbols LOCK_SYMBOLS]
+ [--unlock-symbols UNLOCK_SYMBOLS]
+ pid
Detect potential deadlocks (lock inversions) in a running binary.
Must be run as root.
@@ -342,24 +342,24 @@
be inlined in the binary.
Examples:
- deadlock_detector 181 # Analyze PID 181
+ deadlock 181 # Analyze PID 181
- deadlock_detector 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
+ deadlock 181 --binary /lib/x86_64-linux-gnu/libpthread.so.0
# Analyze PID 181 and locks from this binary.
# If tracing a process that is running from
# a dynamically-linked binary, this argument
# is required and should be the path to the
# pthread library.
- deadlock_detector 181 --verbose
+ deadlock 181 --verbose
# Analyze PID 181 and print statistics about
# the mutex wait graph.
- deadlock_detector 181 --lock-symbols my_mutex_lock1,my_mutex_lock2 \
+ deadlock 181 --lock-symbols my_mutex_lock1,my_mutex_lock2 \
--unlock-symbols my_mutex_unlock1,my_mutex_unlock2
# Analyze PID 181 and trace custom mutex
# symbols instead of pthread mutexes.
- deadlock_detector 181 --dump-graph graph.json
+ deadlock 181 --dump-graph graph.json
# Analyze PID 181 and dump the mutex wait
# graph to graph.json.