-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_one
executable file
·47 lines (38 loc) · 943 Bytes
/
run_one
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
#!/bin/bash
set -e
#set -x
# check params
if [ ! -f "template/$1" -o -z "$3" ]; then
echo "usage: $0 fio_job_template file size [numjobs]" 1>&2
exit
fi
size="$3"
njobs=1
if [ -n "$4" ]; then
njobs=$4
fi
# examine the fio tool
unset SP_FIO_DETECT_PRINT
. ./fio-detect
# prepare config
mkdir -p conf
cp "template/$1" conf/
printf "\n# file autogenerated from templates/$1, please do not edit\n\nfilename=$2\n" >>conf/$1
if [ -n "$size" ]; then
printf "\nsize=$size\n" >>conf/$1
fi
# use the last available CPU in this process's task set
# 0-7 -> 7
# 0-1,4-6,22 -> 22
# 3,7 -> 7
# run test
echo Running test $1
mkdir -p res
cat /proc/stat >res/$1.cpu.pre
if [ $njobs -eq 1 ]; then
cpu="$(taskset -c -p "$$" | sed -e 's/.*[,-]//')"
taskset -c $cpu fio $SP_FIO_PARAMS conf/$1 >res/$1.fio.$SP_FIO_EXT 2>res/$1.fio.err
else
fio $SP_FIO_PARAMS conf/$1 >res/$1.fio.$SP_FIO_EXT 2>res/$1.fio.err
fi
cat /proc/stat >res/$1.cpu.post