-
Notifications
You must be signed in to change notification settings - Fork 202
/
dd
executable file
·52 lines (42 loc) · 1.06 KB
/
dd
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
#!/bin/sh
# - runtime
# - bs
[ -n "$mount_points" ] || { echo "empty mount_points, disk failed?" >&2; exit; }
: ${runtime:=600}
[ -n "$bs" ] && opt_bs="bs=$bs"
t=$(date +%s)
files=
pid=
for i in $(seq ${nr_threads:-1})
do
for mnt in $mount_points
do
file=$mnt/zero-$i
files="$files $file "
rm -f $file
note "dd $opt_bs if=/dev/zero of=$file status=noxfer &"
timeout -s KILL $runtime dd $opt_bs if=/dev/zero of=$file status=noxfer &
[ -n "$BASH_VERSION" ] && disown
pid="${pid} $!"
done
done
ps aux | grep dd
echo $pid > $TMP/pid-dd
tt=$(date +%s)
startup_time=$((tt - t))
echo "startup_time: $startup_time"
cmd sleep $((runtime > startup_time ? runtime - startup_time : 0))
t=$(date +%s)
pkill -9 --exact dd --pidfile $TMP/pid-dd
note killall -9 dd
pkill -9 --exact dd --pidfile $TMP/pid-dd
pkill -9 --exact dd --pidfile $TMP/pid-dd
tt=$(date +%s)
echo "kill_time: $((tt - t))"
chown lkp.lkp $TMP/pid-dd
mv $TMP/pid-dd $RESULT_ROOT/pid
ls -li $files > $RESULT_ROOT/ls-files
truncate --size=0 $files
rm -f $files
t=$(date +%s)
echo "rm_time: $((t - tt))"