forked from flynn/flynn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-info.sh
More file actions
executable file
·44 lines (38 loc) · 864 Bytes
/
debug-info.sh
File metadata and controls
executable file
·44 lines (38 loc) · 864 Bytes
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
#!/bin/bash
#
# This script is run by the CI runner to collect debugging information
# which will be printed if any tests fail.
memwatch() {
interests=("$@")
echo -n $(date "+%H:%M:%S.%3N")
for x in "${interests[@]}"; do
echo -ne "\t${x}"
done
echo
while true; do
snap="$(ps -A -o rss -o cmd)" # downgrade to '-a' or leave it out entirely for confined scope
echo -n $(date "+%H:%M:%S.%3N")
for x in "${interests[@]}"; do
mem="$(echo "$snap" | grep "$x" | grep -v "$0" | awk '{ SUM += $1 } END { print SUM+0 }')"
echo -ne "\t${mem}"
done
echo
sleep 1
done
}
netdebug() {
while true; do
echo "===> $(date +%H:%M:%S.%3N)"
trace ifconfig eth0
trace route -n
trace arp -a
echo "==================="
echo
sleep 5
done
}
trace() {
local cmd=$@
echo "+ ${cmd}"
$cmd
}