From da017d68883db831f3af88ab733a40046ef25d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toralf=20F=C3=B6rster?= Date: Wed, 25 Jun 2014 22:46:31 +0200 Subject: [PATCH 1/4] tools/times.sh: adapt comment to the actual loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit left over from #ea9f0718 Signed-off-by: Toralf Förster --- tools/times.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/times.sh b/tools/times.sh index ca0e60bd9..110d96b37 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Simple script to generate times.log that contains timing information for the last 20 revisions +# Simple script to generate times.log that contains timing information for the last revisions # Typically these commands shall be used to get times.txt: mkdir -p src cp lib/* src/ # fill src/ with some source code From fa18adea6f9d5432f482a170f05390438c356439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toralf=20F=C3=B6rster?= Date: Wed, 25 Jun 2014 22:48:56 +0200 Subject: [PATCH 2/4] tools/times.sh: prefer a loop over repeating the same command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Toralf Förster --- tools/times.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/times.sh b/tools/times.sh index 110d96b37..513dde40a 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -20,10 +20,9 @@ for i in `seq 1 50`; do # if build fails, make clean and try again make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4 echo "Run number $i" - ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log - ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log - ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log - ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log + for j in `seq 1 4`; do + ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log + done grep "Overall" times.log | tail -4 | sed s/s// | awk -v "i=$i" -v "git_head=$git_head" '{ sum+=$3} END {print "Run " i", "git_head " Average: " sum/4}' | tee -a times.log git reset --hard HEAD^1 | tee -a times.log done From 4b135b935d6f4baa4dbc5f06e818568924f95693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toralf=20F=C3=B6rster?= Date: Wed, 25 Jun 2014 22:49:47 +0200 Subject: [PATCH 3/4] tools/times.sh: use always long-opts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Toralf Förster --- tools/times.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/times.sh b/tools/times.sh index 513dde40a..931c44e31 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -21,7 +21,7 @@ for i in `seq 1 50`; do make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4 echo "Run number $i" for j in `seq 1 4`; do - ./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log + ./cppcheck --quiet --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log done grep "Overall" times.log | tail -4 | sed s/s// | awk -v "i=$i" -v "git_head=$git_head" '{ sum+=$3} END {print "Run " i", "git_head " Average: " sum/4}' | tee -a times.log git reset --hard HEAD^1 | tee -a times.log From c1d8d1b26a6a1d7dee1fb8969eccb8caabf526ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toralf=20F=C3=B6rster?= Date: Wed, 25 Jun 2014 22:55:51 +0200 Subject: [PATCH 4/4] tools/times.sh: exit if prereq were not met MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Toralf Förster --- tools/times.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/times.sh b/tools/times.sh index 931c44e31..c34e86fbd 100755 --- a/tools/times.sh +++ b/tools/times.sh @@ -2,8 +2,8 @@ # # Simple script to generate times.log that contains timing information for the last revisions # Typically these commands shall be used to get times.txt: -mkdir -p src -cp lib/* src/ # fill src/ with some source code +mkdir -p src || exit 1 +cp lib/* src/ || exit 2 # fill src/ with some source code #NOTE: also try with some files other then from cppcheck!