File: debug-helpers.sh

package info (click to toggle)
python-mitogen 0.3.25~a2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,220 kB
  • sloc: python: 21,989; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (39 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Bash helpers for debugging.
#

# Tell Ansible to write PID files for the mux and top-level process to CWD.
export MITOGEN_SAVE_PIDS=1


# strace -ff -p $(muxpid)
muxpid() {
    cat .ansible-mux.pid
}

# gdb -p $(anspid)
anspid() {
    cat .ansible-controller.pid
}

# perf top -git $(muxtids)
# perf top -git $(muxtids)
muxtids() {
    ls /proc/$(muxpid)/task | tr \\n ,
}

# perf top -git $(anstids)
anstids() {
    ls /proc/$(anspid)/task | tr \\n ,
}

# ttrace $(muxpid) [.. options ..]
#   strace only threads of PID, not children
ttrace() {
    local pid=$1; shift;
    local s=""
    for i in $(ls /proc/$pid/task) ; do
        s="-p $i $s"
    done
    strace $s "$@"
}