-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun
executable file
·82 lines (62 loc) · 1.72 KB
/
run
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
76
77
78
79
80
81
82
#!/bin/bash
BASE_DIR=$(dirname $0)
cd $BASE_DIR
fstype=$(grep "/fs " /proc/mounts | cut -f3 -d' ')
[[ $fstype ]] || { echo "no filesystem mounted on /fs"; exit 1; }
[ -f /cgroup/blkio.weight ] || mount -t cgroup -o blkio none /cgroup
echo $((500<<20)) > /proc/sys/vm/dirty_bytes
echo 1 > /debug/tracing/events/writeback/balance_dirty_pages/enable
echo 1 > /debug/tracing/events/writeback/bdi_dirty_ratelimit/enable
echo 1 > /debug/tracing/events/writeback/blkcg_dirty_ratelimit/enable
echo 1 > /debug/tracing/events/writeback/task_io/enable
# echo 1 > /sys/block/sda/trace/enable
start_tracing() {
echo > /debug/tracing/trace
# the fifo trick serves to avoid killing bzip2 directly
test -p /tmp/trace_fifo || mkfifo /tmp/trace_fifo
bzip2 < /tmp/trace_fifo > trace.bz2 &
cat /debug/tracing/trace_pipe > /tmp/trace_fifo &
disown %% # avoid the "Terminated" message on kill
echo $! > pid-trace
}
run_cgroup_dd() {
nr_cg=$1
nr_dd=$2
shift 2 # the remaining $* will be fed to dd
for i in $(seq $nr_cg)
do
mkdir /cgroup/g$i
echo $$ > /cgroup/g$i/tasks
for j in $(seq $nr_dd)
do
dd if=/dev/zero of=/fs/zero-cg$i-dd$j $* &
done
done
}
export -f run_cgroup_dd
for testcase
do
[[ $HOST ]] || HOST=$(</etc/hostname)
dir=log/$HOST/$fstype/$testcase.`date +%F-%H-%M`
echo $dir
mkdir -p $dir
cd $dir
start_tracing
$BASE_DIR/$testcase
echo $$ > /cgroup/tasks
cat /cgroup/*/tasks > pid
sleep 100
grep . /cgroup/*/* 2>/dev/null > cgroups
kill $(cat pid pid-*)
rm pid-*
ls -l /fs > ls-files
uname -a > uname
wait
$BASE_DIR/plot-task-bw.sh .
$BASE_DIR/plot-balance_dirty_pages.sh .
$BASE_DIR/plot-blkcg-weight-ratelimit.sh .
chown -R wfg .
cd $BASE_DIR
rmdir /cgroup/*/
rm /fs/zero*
done