Merge pull request #347 from toralf/timer

Timer
This commit is contained in:
Daniel Marjamäki 2014-06-26 05:45:08 +02:00
commit 5fc3e37842
1 changed files with 6 additions and 7 deletions

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/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 <n> revisions
# Typically these commands shall be used to get times.txt: # Typically these commands shall be used to get times.txt:
mkdir -p src mkdir -p src || exit 1
cp lib/* src/ # fill src/ with some source code cp lib/* src/ || exit 2 # fill src/ with some source code
#NOTE: also try with some files other then from cppcheck! #NOTE: also try with some files other then from cppcheck!
@ -20,10 +20,9 @@ for i in `seq 1 50`; do
# if build fails, make clean and try again # if build fails, make clean and try again
make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4 make SRCDIR=build CXXFLAGS=-O2 -j4 || make clean ; make SRCDIR=build CXXFLAGS=-O2 -j4
echo "Run number $i" echo "Run number $i"
./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 ./cppcheck --quiet --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 done
./cppcheck -q --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log
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 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 git reset --hard HEAD^1 | tee -a times.log
done done