Add installation script for phoronix-static.
[gcc-perf-regression-tester.git] / set_config.sh
blobe3fe5568c43d6366a780a4d6bc4739f626193048
1 #!/bin/bash -x
3 # Copyright (C) 2011 Sebastian Pop <sebpop@gmail.com>.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. A copy of this license
13 # can be downloaded from http://www.gnu.org/copyleft/gpl.html
15 # This file is sourced at the beginning of every benchmark in the
16 # go.sh script. It sets the CONFIG and FLAGS variables and outputs
17 # their values to the LOG file.
19 X=$HOME/gcc/test
20 B=$X/bmks/$bmk
21 config=$1
23 case "$config" in
24 loop-interchange-block)
25 FLAGS="-O3 -funroll-loops -fpeel-loops -ffast-math -march=native -floop-interchange -floop-block"
27 O2)
28 FLAGS="-O2 -march=native"
30 lto)
31 FLAGS="-O3 -funroll-loops -fpeel-loops -ffast-math -march=native -flto -fwhole-program -flto-partition=none"
33 Ofast)
34 FLAGS="-Ofast -march=native"
36 ofast | "")
37 FLAGS="-O3 -funroll-loops -fpeel-loops -ffast-math -march=native"
38 config="ofast"
41 echo "Config $config not handled."
42 exit 0
44 esac
46 CFLAGS=$FLAGS
47 CXXFLAGS=$FLAGS
48 FFLAGS=$FLAGS
50 now=`date +"%Y_%m_%d_%H_%M_%S"`
51 tag="${bmk}_${config}_${now}"
52 log=$X/log/$tag
53 mkdir -p $X/log
55 echo "config file: $config" > $log
56 echo "FLAGS=$FLAGS" >> $log
58 catlog () {
59 f=$1
60 shift
61 if test -e $f; then
62 x=/tmp/catlog
63 > $x
64 echo "(cat $f" >> $x
65 cat $f >> $x
66 for i in `seq 1 $#`; do
67 eval y=\$$i
68 sed -i -e "/$y/d" $x
69 done
70 echo "tac $f)" >> $x
71 cat $x >> $log
75 procs=`cat /proc/cpuinfo | grep "processor" | sort | tail -1 | cut -d ':' -f2 | sed -e 's/ //g'`
76 procs=`echo "$procs + 1" | bc`