source: utils/developer/MeasurePreprocessedFileSizes.sh@ c4c20a

Last change on this file since c4c20a was c4c20a, checked in by Frederik Heber <heber@…>, 11 years ago

Wrote script file to measure the size of each preprocessed file.

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/bin/bash
2
3test ! -z "$1" || { echo "Usage: $0 <srcdir>"; exit 255; }
4SOURCEDIR=$1
5test -e $SOURCEDIR || { echo "srcdir $SOURCEDIR does not exist."; exit 255; }
6
7INCLUDES="-I$SOURCEDIR -I$SOURCEDIR/unittests -I$SOURCEDIR/Actions -I$SOURCEDIR/UIElements -I$SOURCEDIR/../LinearAlgebra/src"
8CODEPATTERNS="-I/home/heber/packages/CodePatterns-1.2.8/include"
9BOOST=""
10JOBMARKET="-I/home/heber/packages/JobMarket-1.1.4_1.2.8/include"
11PYTHON="-I/usr/include/python2.7"
12QT="-I/usr/include/qt4 -I/usr/include/qt4/Qt -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore"
13QWT="-I/usr/include/qwt-qt4"
14BUILDDIR="-I/home/heber/workspace_C/molecuilder/build64/src"
15SCAFACOS="-I/home/heber/packages/ScaFaCoS-0.1.0-debug_open/include -I/home/heber/workspace_C/scafacos/lib/vmg/src"
16COMMON="-I/usr/include"
17MPI="-DMPI"
18
19list=`find $SOURCEDIR -name '*.cpp'`
20
21test ! -e test.cpp || { echo "There already is a test.cpp in the current dir."; exit 255; }
22
23files=0
24worlds=0
25averagesize=0
26for file in $list; do
27 CURRENTDIR=`dirname $file`
28 cpp -E -I$CURRENTDIR -I$CURRENTDIR/.. $INCLUDES $COMMON $BUILDDIR $CODEPATTERNS $JOBMARKET $BOOST $PYTHON $QT $QWT $SCAFACOS $MPI -DHAVE_CONFIG_H $file >test.cpp
29 test $? -eq 0 || { echo "Some includes still missing for $file."; exit 255; }
30 lines=`wc -l test.cpp | awk -F" " '{print $1}'`
31 let averagesize=$averagesize+$lines
32 grep World.hpp $file >/dev/null
33 world=$?
34 let files=$files+1
35 let worlds=$worlds+$world
36 rm -f test.cpp
37 echo -n "`basename $file`: $lines, "
38 if test $world -eq 0; then
39 echo "not present."
40 else
41 echo "PRESENT."
42 fi
43done
44mean=`echo "$averagesize $files" | awk -F" " '{print $1/$2}'`
45echo "$worlds of $files contain World.hpp in include tree."
46echo "The mean number of lines is $mean."
47
48exit 0
49
Note: See TracBrowser for help on using the repository browser.