2012-11-27 06:08:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2014-06-25 22:46:31 +02:00
|
|
|
# Simple script to generate times.log that contains timing information for the last <n> revisions
|
2012-11-27 06:08:26 +01:00
|
|
|
# Typically these commands shall be used to get times.txt:
|
2014-06-25 22:55:51 +02:00
|
|
|
mkdir -p src || exit 1
|
|
|
|
cp lib/* src/ || exit 2 # fill src/ with some source code
|
2014-03-17 02:10:02 +01:00
|
|
|
#NOTE: also try with some files other then from cppcheck!
|
2012-11-27 06:08:26 +01:00
|
|
|
|
2014-03-17 02:10:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
# if "old" already exists for some reason, do NOT work on current branch but bail out
|
|
|
|
git checkout -b old || exit
|
2012-11-27 06:08:26 +01:00
|
|
|
|
|
|
|
make clean
|
|
|
|
|
|
|
|
git reset --hard HEAD > times.log
|
|
|
|
|
2014-03-17 02:10:02 +01:00
|
|
|
for i in `seq 1 50`; do
|
2014-03-17 08:40:01 +01:00
|
|
|
git_head=`git log -1 --format=%h`
|
|
|
|
# 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"
|
2014-06-25 22:48:56 +02:00
|
|
|
for j in `seq 1 4`; do
|
2014-06-25 22:49:47 +02:00
|
|
|
./cppcheck --quiet --showtime=summary --enable=all --inconclusive src 2> /dev/null | tee -a times.log
|
2014-06-25 22:48:56 +02:00
|
|
|
done
|
2014-03-17 08:40:01 +01:00
|
|
|
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
|
2014-03-17 02:10:02 +01:00
|
|
|
done
|
2012-11-27 06:08:26 +01:00
|
|
|
|
2014-03-17 02:10:02 +01:00
|
|
|
gcc -o tools/times tools/times.c
|
|
|
|
tools/times
|