]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/build-profile.sh
Merge branch 'master' of ssh+git://hanwen@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 cat > long-score.ly << EOF
33 \version "2.10.0"
34 foo = \new Staff \new Voice \repeat unfold 50 \relative { c4 d8[ d16( e]~ e16[ e e) f] g8  }
35 \new ChoirStaff << 
36   \foo \foo \foo \foo 
37   \foo \foo \foo \foo 
38
39 >>
40 EOF
41
42 rm gmon.sum
43
44 exe=$depth/out-prof/bin/lilypond
45
46 ## todo: figure out representative sample.
47 files="wtk1-fugue2 wtk1-fugue2 wtk1-fugue2 wtk1-fugue2 mozart-hrn-3  mozart-hrn-3  long-score"
48
49
50
51 $exe -ddump-profile --formats=ps -I $depth/input/ -I  $depth/input/mutopia/J.S.Bach/ \
52     -I $depth/input/mutopia/W.A.Mozart/ \
53     $files
54
55
56 for a in *.profile; do
57   echo $a
58   cat $a
59 done
60
61 echo 'running gprof' 
62 gprof $exe > profile
63
64 exit 0
65
66
67 ## gprof -s takes forever.
68 for a in seq 1 3; do
69   for f in $files ; do
70     $exe -ddump-profile --formats=ps -I $depth/input/ -I  $depth/input/mutopia/J.S.Bach/ \
71        -I $depth/input/mutopia/W.A.Mozart/ \
72        $f
73
74     echo 'running gprof' 
75     if test -f gmon.sum ; then
76       gprof -s $exe gmon.out gmon.sum
77     else
78       mv gmon.out gmon.sum
79     fi
80   done
81 done
82
83 gprof $exe gmon.sum > profile