Newer
Older
export AFL_SKIP_CPUFREQ=1
export AFL_SKIP_BIN_CHECK=1
export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1
all_benchmarks="
600.perlbench_s 602.gcc_s 603.bwaves_s 605.mcf_s 607.cactuBSSN_s 619.lbm_s 620.omnetpp_s 621.wrf_s 623.xalancbmk_s 625.x264_s 627.cam4_s 628.pop2_s 631.deepsjeng_s 638.imagick_s 641.leela_s 644.nab_s 648.exchange2_s 649.fotonik3d_s 654.roms_s 657.xz_s 996.specrand_fs 998.specrand_is
"
number=1
setup()
{
if [ ! -d spec2017 ]; then
#svn co ^/spec2017/trunk spec2017
git clone --depth 1 git@git.zephyr-software.com:allzp/spec2017.git spec2017
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
197
198
199
200
201
202
203
204
205
fi
if [[ ! -f /usr/bin/gfortran ]]; then
sudo apt-get install gfortran gcc g++ -y
fi
cd spec2017/
source shrc
}
run_test()
{
local config_name="$1"
local config="$2"
local benchmarks="$3"
tests_that_ran="$tests_that_ran $config_name"
cd $SPEC
if [ ! -d result.$config_name ]; then
bash -x $PEASOUP_UMBRELLA_DIR/postgres_reset.sh
rm -Rf result/*
runcpu --action scrub --config $config $benchmarks
echo
echo "**************************************************************************"
echo "Starting test of $config_name"
echo "**************************************************************************"
echo
#runspec --action validate --config $config -n $number $benchmarks
runcpu --config $config --iterations $number --size $run_size --copies=8 --parallel_test_workload $run_size --noreportable $benchmarks
cp benchspec/CPU/*/exe/* result
mv result result.$config_name
for bench in $benchmarks
do
mv benchspec/CPU/$bench/build/build*/peasoup*/logs result.$config_name/$bench.log
done
fi
}
get_size_result()
{
bench=$1
if [ -e $bench ]; then
size=$(stat --printf="%s" $bench)
#echo -n "$size"
#LC_ALL= numfmt --grouping $size
#LC_ALL= printf "%'d" $size
#LC_NUMERIC=en_US printf "%'d" $size
#LC_NUMERIC=en_US printf "%'f" $size
#LC_NUMERIC=en_US printf "%'.f" $size
#LC_NUMERIC=en_US printf "%'10.10f" $size
#LC_NUMERIC=en_US /usr/bin/printf "%'d" $size
echo $size
else
echo -n "0"
fi
}
get_result()
{
bench=$1
config=$2
results=$(cat $SPEC/result.$config/CPU2017.002.log|grep Success|grep $bench|grep ratio=|sed 's/.*ratio=//'|sed 's/,.*//')
sum=0
count=0
for res in $results
do
sum=$(echo $sum + $res | bc)
count=$(echo $count + 1 | bc)
done
#echo sum=$sum
#echo count=$count
res=$(echo "scale=2; $sum / $count" | bc 2> /dev/null )
count=$(echo $res|wc -w)
if [ $count = 1 ]; then
echo -n $res
else
echo -n "0"
fi
}
get_raw_results()
{
get_raw_perf_results $tests_that_ran
get_raw_size_results $tests_that_ran
#get_raw_fde_results $tests_that_ran
}
get_raw_perf_results()
{
configs="$*"
first_config=$1
echo "--------------------------------------------------------------"
echo "Performance results are:"
echo "--------------------------------------------------------------"
echo benchmark $configs
for bench in $all_benchmarks
do
echo -n "$bench "
for config in $*
do
get_result $bench $config
echo -n " "
done
echo
done
}
get_raw_size_results()
{
echo "--------------------------------------------------------------"
echo "Size results are:"
echo "--------------------------------------------------------------"
configs=$*
echo benchmark $configs
for bench in $SPEC/result.$first_config/*mytest-m64
do
echo -n "$(basename $bench _base.mytest-m64) "
for config in $*
do
if [[ $config == "baseline" ]]; then
file="$SPEC/result.$config/$(basename $bench)"
cp $file /tmp/foo.exe
strip /tmp/foo.exe
file="/tmp/foo.exe"
else
file="$SPEC/result.$config/$(basename $bench)"
fi
res=$(get_size_result $file)
#printf "%15s" $res
echo -n " $res"
done
echo
done
}
get_raw_fde_results()
{
echo "--------------------------------------------------------------"
echo "FDE results are:"
echo "--------------------------------------------------------------"
configs=$*
echo benchmark $configs
for bench in $SPEC/result.$first_config/*mytest-m64
do
#printf "%-20s" $(basename $bench _base.amd64-m64-gcc42-nn)
echo -n $(basename $bench _base.amd64-m64-gcc42-nn)
for config in $*
do
file="$SPEC/result.$config/$(basename $bench)"
res=$(readelf -w $file |grep FDE|wc -l )
#if [[ $config == "baseline" ]]; then
#else
#fi
#printf "%15s" $res
echo -n " $res"
done
echo
done
}
main()
{
local zipr_flags=" --backend zipr --step-option zipr:--add-sections --step-option zipr:true"
local trace_flags=" --step-option zipr:--traceplacement:on --step-option zipr:true"
local relax_flags=" --step-option zipr:--relax:on --step-option zipr:true --step-option zipr:--unpin:on --step-option zipr:false"
local nounpin_flags=" --step-option zipr:--unpin:on --step-option zipr:false"
local split_flags=" --step-option fill_in_indtargs:--split-eh-frame "
local icall_flags=" --step-option fix_calls:--no-fix-icalls "
local p1flags=" -c p1transform=on "
local zafl_flags=" "
local zafl_domgraphflags=" -d "
# sets $SPEC
setup
local nops_config=$SPEC/config/ubuntu14.cfg
local withps_config=$SPEC/config/ubuntu14_withps.cfg
# baseline
run_test baseline $SPEC/config/ubuntu14.cfg "$all_benchmarks"
PSOPTS="$zipr_flags $rida_flags " run_test zipr.rida $withps_config "$all_benchmarks"
PS="zafl.sh" PSOPTS="$zafl_flags " run_test zafl.vanilla $withps_config "$all_benchmarks"
PS="zafl.sh" PSOPTS="$zafl_domgraph_flags " run_test zafl.domgraph $withps_config "$all_benchmarks"