-
Notifications
You must be signed in to change notification settings - Fork 1
/
execute_pbench
executable file
·196 lines (183 loc) · 4.85 KB
/
execute_pbench
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
source ~/.bashrc
echo Called execute_pbench >> /tmp/debugging
chars=`echo $0 | awk -v RS='/' 'END{print NR-1}'`
TOOLS_BIN=`echo $0 | cut -d'/' -f 1-${chars}`
cmd_executing=""
configuration=""
puser=""
run_label=""
spacing=0
sys_type=""
test_name=""
times_to_run=1
results_dir=""
pbench_copy=1
pbench_stats="default"
#
# Usage information.
#
usage()
{
echo "$1 usage:"
echo " --sysname: name of the system running, used in determing config files"
echo "tools_git: Pointer to the test_tools git. Default is ${tools_git}. Top directory is always test_tools"
echo " --tuned_setting: used in naming the tar file"
echo " --usage: this usage message"
echo " --pbench: use pbench-user-benchmark and place information into pbench"
echo " --pbench_user: user who started everything."
echo " --pbench_stats: stats to execute with, default is all"
echo "Unused options, present as Zathras passes them in."
echo " --host_config"
echo " --home_parent"
echo " --iterations"
echo " --no_pbench_copy: do not copy pbench data up."
echo " --results_dir: subdirectory to put results into."
echo " --run_label: the label to associate with the pbench run"
echo " --run_user"
echo " --sys_type"
exit
}
#
# Now handle the command options
#
i=1
j=$#
separ=""
cmd_options=""
while [ $i -le $j ]
do
case "$1" in
--cmd_executing)
cmd_executing=${2}
i=$((i + 2))
shift 2
;;
--host_config)
configuration=${2}
cmd_options="${cmd_options}${separ}${1} ${2}"
separ=" "
i=$((i + 2))
shift 2
;;
--iterations)
cmd_options="${cmd_options}${separ}--iterations 1"
separ=" "
times_to_run=${2}
i=$((i + 2))
shift 2
;;
--no_pbench_copy)
pbench_copy=0
shift 1
;;
--pbench)
i=$((i + 1))
shift 1
;;
--pbench_stats)
pbench_stats=$2
i=$((i + 2))
shift 2
;;
--pbench_user)
puser=$2
i=$((i + 2))
shift 2
;;
--results_dir)
results_dir=${2}
shift 2
;;
--run_label)
i=$((i + 2))
run_label=$2
shift 2
;;
--spacing)
spacing=${2}
shift 2
;;
--sys_type)
cmd_options="${cmd_options}${separ}${1} ${2}"
separ=" "
sys_type=${2}
shift 2
;;
--test)
test_name=${2}
shift 2
;;
--)
break;
;;
*)
cmd_options="${cmd_options}${separ}${1}"
separ=" "
shift 1
i=$((i + 1))
if [[ $1 != *"--"* ]]; then
i=$((i + 1))
cmd_options="${cmd_options}${separ}${1}"
shift 1
fi
;;
esac
done
if [[ $pbench_stats != "default" ]]; then
pushd /var/lib/pbench-agent > /dev/null
rm -rf tools-v1-zathras
cp -R tools-v1-default tools-v1-zathras
cd tools-v1-zathras
dir=`ls -d *ip*`
cd $dir
mkdir ../back
mv * ../back
tools=`echo $pbench_stats | sed "s/,/ /g"`
for i in $tools; do
cp ../back/$i .
done
rm -rf ../back
popd > /dev/null
pbench_stats="zathras"
fi
echo $times_to_run > ./iteration.lis
echo Calling pbench-user-benchmark >> /tmp/debugging
echo pbench-user-benchmark -C ${puser}_${test_name}_test --iteration-list=./iteration.lis -- $cmd_executing ${cmd_options}
pbench-user-benchmark -C ${puser}_${test_name}_test --tool-group=${pbench_stats} --iteration-list=./iteration.lis -- $cmd_executing ${cmd_options}
echo returned from pbench-user-benchmark >> /tmp/debugging
dir=`ls -rtd /var/lib/pbench-agent/pben*${test_name}* | tail -1`
pushd /tmp > /dev/null
last_tar=`ls -rtd results_*${test_name}_* | grep tar | tail -1`
tar xf $last_tar
popd > /dev/null
last_dir=`ls -rtd /tmp/results_*${test_name}_* | grep -v tar | tail -1`
pushd $dir > /dev/null
cp $last_dir/results_${test_name}.csv .
echo ${TOOLS_BIN}/convert_csv_to_txt --field_seper : --field_size ${spacing} --results_in results_${test_name}.csv --results_out results.txt
${TOOLS_BIN}/convert_csv_to_txt --field_seper : --field_size ${spacing} --results_in results_${test_name}.csv --results_out results.txt
last_tar=`ls -rtd /tmp/results_*${test_name}_*tar | tail -1`
tar xf $last_tar
cd /tmp
mv_tar_to=`echo $last_tar | sed "s/results_*${test_name}/results_pbench_${test_name}/"`
mv $last_tar $mv_tar_to
value=`$TOOLS_BIN/set_pbench_variables --host_config $configuration --sys_type $sys_type --test ${test_name} --pbench_user $puser --run_label $run_label`
results_prefix=`echo $value | cut -d: -f 2`
if [[ $results_dir != "" ]]; then
results_prefix=${results_prefix}/${results_dir}
fi
hostname=`echo $value | cut -d: -f 1`
if [ $pbench_copy -eq 1 ]; then
echo $TOOLS_BIN/pbench_copy_data --hostname "${hostname}" --user "${puser}" --prefix ${results_prefix} >> /tmp/debugging
$TOOLS_BIN/pbench_copy_data --hostname "${hostname}" --user "${puser}" --prefix ${results_prefix}
fi
#
# Move results in /tmp to be results_pbench.....
# Keeps Zathras happy, and matches with what was run.
#
cd /tmp
files=`ls results_*.tar | grep -v pbench`
for i in $files; do
move_to=`echo $files | sed "s/^results_s/results_pbench_/"`
mv $i $move_to
done