2 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 source .
/bench_common.sh
19 source .
/bench_plot.sh
21 ## CONFIGURATION OPTIONS ##
23 # Default number of times a command must be run with bench_command
24 # Can be overrided with 'the option -n'
31 echo "bench_nitdoc [options]* git-ref"
32 echo " -v: verbose mode"
33 echo " -n count: number of execution for each bar (default: $count)"
34 echo " --dry: Do not run the commands, just reuse the data and generate the graph"
39 while [ "$stop" = false
]; do
41 -v
) verbose
=true
; shift;;
43 -n
) count
="$2"; shift; shift;;
44 --dry
) dry_run
=true
; shift;;
51 if test -z
"$REF"; then
56 current_branch
=`git rev-parse --abbrev-ref HEAD`
57 git checkout origin
/master
&& ..
/bin
/nitc ..
/src
/nitdoc.nit
-o .
/nitdoc.orig
58 git checkout
$current_branch && ..
/bin
/nitc ..
/src
/nitdoc.nit
-o .
/nitdoc.new
60 ## EFFECTIVE BENCHS ##
62 function bench_nitdoc
()
64 basedir
="./bench_nitdoc.out/${name}.out"
65 tests
=(..
/tests
/test_prog ..
/lib
/standard
/kernel.nit ..
/lib
/standard
)
68 prepare_res
$basedir/orig.dat
$REF "nitdoc.orig"
69 for path
in ${tests[@]}; do
70 run_gen
$basedir .
/nitdoc.orig
$path
73 prepare_res
$basedir/new.dat
"HEAD" "nitdoc.new"
74 for path
in ${tests[@]}; do
75 run_gen
$basedir .
/nitdoc.new
$path
78 plot
$basedir/bench_nitdoc.gnu
86 name
=`basename $path .nit`
87 bench_command
$name $path $bin $path -d
$basedir/$bin.out
92 if test -n
"$died"; then
93 echo "Some commands failed"