diff options
Diffstat (limited to 'src/benchmark-flags')
-rwxr-xr-x | src/benchmark-flags | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/benchmark-flags b/src/benchmark-flags index de54d42..9c8c4ba 100755 --- a/src/benchmark-flags +++ b/src/benchmark-flags @@ -19,7 +19,9 @@ set -e export LD_LIBRARY_PATH=bin -TRIES=10 +if [ "${TRIES}" = "" ]; then + TRIES=10 +fi # List all flags that affect the object files list_test_flags () @@ -36,6 +38,8 @@ base_flags='-march=native -O0' test_flags=" $(echo $(list_test_flags)) " pass=1 +exec 4>.benchmark.so.far + while true; do exec 3>.benchmarks @@ -55,20 +59,26 @@ while true; do ! grep ^error .benchmarks >/dev/null 2>/dev/null - good_flag="$(sort < .benchmarks | cut -d ' ' -f 2 | sed 1q)" - if [ "${good_flag}" = zzz ]; then + good_flag="$(sort -n < .benchmarks | cut -d ' ' -f 2 | sed 1q)" + if [ "${good_flag}" = zzz ] || [ $pass = 2 ]; then if [ $pass = 1 ]; then pass=2 base_flags="$(echo "${base_flags}" | sed -e 's/ -O0//')" test_flags="-O0 -O1 -O2 -O3 -Ofast -Os" else + if [ ! "${good_flag}" = zzz ]; then + base_flags="${base_flags} ${good_flag}" + echo "${good_flag}" >&4 + fi echo echo echo "Good flags:" echo "${base_flags}" + exec 4<&- exit 0 fi else + echo "${good_flag}" >&4 base_flags="${base_flags} ${good_flag}" test_flags="$(echo "${test_flags}" | sed -e "s/ ${good_flag} / /")" fi |