-
Notifications
You must be signed in to change notification settings - Fork 27
/
get_int_stacks.sh
executable file
·75 lines (73 loc) · 2.11 KB
/
get_int_stacks.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
get_interesting_stacks() {
awk -F'[ #@]+' '
function isinteresting() {
if ((stack[0] == "select") && (stack[1] == "DS_Sleep")) {
# not interesting
return 0
}
if ((stack[0] == "pthread_cond_timedwait") && (stack[1] == "PR_WaitCondVar")) {
# not interesting
return 0
}
if ((stack[0] == "pthread_cond_timedwait") && (stack[2] == "PR_WaitCondVar")) {
# not interesting
return 0
}
if ((stack[0] == "pthread_cond_wait") && (stack[1] == "PR_WaitCondVar")) {
# not interesting
return 0
}
if ((stack[0] == "pthread_cond_timedwait") && (stack[1] == "pt_TimedWait")) {
# not interesting
return 0
}
if ((stack[0] == "pt_TimedWait") && (stack[1] == "PR_WaitCondVar")) {
# not interesting
return 0
}
if ((stack[0] == "PR_WaitCondVar") && (stack[1] == "slapi_wait_condvar")) {
# not interesting
return 0
}
if ((stack[0] == "__poll") && (stack[1] == "_pr_poll_with_poll") && (stack[2] == "slapd_daemon")) {
# not interesting
return 0
}
return 1
}
function printstack() {
print "Thread", threadnum
str=stack[0]
for (ii = 0; ii <= 200; ++ii) {
if (ii in stack) {
str=str " " stack[ii]
}
}
print str
}
function procstack() {
if (isinteresting()) {
printstack()
intthreads++
print ""
}
delete stack
inthread=0
}
BEGIN {inthread=0;intthreads=0}
/^Thread / {inthread=1; threadnum=$2; next}
/^#[0-9][0-9]* *0x.* in / {
stack[$2] = $5
next
}
/^#[0-9][0-9]* .* at / {
stack[$2] = $3
next
}
/^[\r\n]*$/ && inthread {procstack(); inthread=0; next}
END {procstack(); print "Found", intthreads, "interesting threads"}
'
}
# /^$/ && inthread {procstack(); inthread=0; next}
get_interesting_stacks