]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/build-profile.sh
Merge branch 'master' of ssh+git://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / buildscripts / build-profile.sh
1 #!/bin/sh
2
3 if test "$1" == "--fresh"; then
4   fresh=yes
5 fi
6
7 if test ! -f config-prof.make; then
8   fresh=yes
9 fi
10
11 if test "$fresh" = "yes";
12 then
13   ./configure --enable-config=prof --enable-optimising \
14    &&   perl -i~ -pe 's/-pipe /-pg -pipe /g' config-prof.make \
15    &&   perl -i~ -pe 's/ -ldl / -pg -ldl /g' config-prof.make
16 fi
17
18 make conf=prof -j2
19
20 if test "$?" != "0"; then
21   exit 2
22 fi
23
24 depth=../..
25 resultdir=out/profile-results
26
27 rm -rf $resultdir
28 mkdir $resultdir
29 cd $resultdir
30
31
32 echo 'foo = \new Staff \new Voice \repeat unfold 50 \relative { c4 d8[ d16( e]~ e16[ e e) f] g8  }
33 \new ChoirStaff << 
34   \foo \foo \foo \foo 
35   \foo \foo \foo \foo 
36
37 >>' > long-score.ly
38
39 rm gmon.sum
40
41 exe=$depth/out-prof/bin/lilypond
42
43 ## todo: figure out representative sample.
44 files="wtk1-fugue2 wtk1-fugue2 wtk1-fugue2 wtk1-fugue2 mozart-hrn-3  mozart-hrn-3  long-score"
45
46
47
48 $exe -ddump-profile --formats=ps -I $depth/input/ -I  $depth/input/mutopia/J.S.Bach/ \
49     -I $depth/input/mutopia/W.A.Mozart/ \
50     $files
51
52
53 for a in *.profile; do
54   echo $a
55   cat $a
56 done
57
58 echo 'running gprof' 
59 gprof $exe > profile
60
61 exit 0
62
63
64 ## gprof -s takes forever.
65 for a in seq 1 3; do
66   for f in $files ; do
67     $exe -ddump-profile --formats=ps -I $depth/input/ -I  $depth/input/mutopia/J.S.Bach/ \
68        -I $depth/input/mutopia/W.A.Mozart/ \
69        $f
70
71     echo 'running gprof' 
72     if test -f gmon.sum ; then
73       gprof -s $exe gmon.out gmon.sum
74     else
75       mv gmon.out gmon.sum
76     fi
77   done
78 done
79
80 gprof $exe gmon.sum > profile