From 99aa9319c8d02751484eb24057116545481c1742 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 6 Nov 2014 00:30:33 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/benchmark-flags | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/benchmark-flags') 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 -- cgit v1.2.3-70-g09d2