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.
16 # Shell script to bench nitmd over different kind of document.
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'
27 # Default number of times the input file is transformed during a single run
34 echo "run_bench: [options]* benchname"
35 echo " -v: verbose mode"
36 echo " -n count: number of execution for each bar (default: $count)"
37 echo " -s size: number of transformations for each run (default: $s)"
38 echo " --dry: Do not run the commands, just reuse the data and generate the graph"
43 while [ "$stop" = false
]; do
45 -v
) verbose
=true
; shift;;
47 -n
) count
="$2"; shift; shift;;
48 -s
) s
="$2"; shift; shift;;
49 --dry
) dry_run
=true
; shift;;
55 cd benches
; make; cd ..
58 cd engines
; make; cd ..
62 if test -z
"$NOTSKIPED"; then
64 echo "List of available benches:"
65 echo "* all: run all the benches"
68 ## EFFECTIVE BENCHS ##
71 bncdir
="./benches/out"
74 function bench_nitmd
()
77 skip_test
"$name" && return
78 prepare_res
$outdir/nitmd.dat
"nitmd" "nitmd"
79 for file in $bncdir/*.md
; do
80 bench
=`basename $file .md`
81 bench_command
"$bench" "" "$engdir/nitmd/nitmd" "$file" "$s"
86 function bench_nitmd
-o
()
89 skip_test
"$name" && return
90 prepare_res
$outdir/nitmd
-o.dat
"nitmd-o" "nitmd-o"
91 for file in $bncdir/*.md
; do
92 bench
=`basename $file .md`
93 bench_command
"$bench" "" "$engdir/nitmd/nitmd-o" "$file" "$s"
98 function bench_txtmark
()
101 skip_test
"$name" && return
102 prepare_res
$outdir/txtmark.dat
"txtmark" "txtmark"
103 for file in $bncdir/*.md
; do
104 bench
=`basename $file .md`
105 bench_command
"$bench" "" "java" "-cp" "$engdir/txtmark/.:$engdir/txtmark/txtmark-0.11.jar" "Txtmark" "$file" "$s"
110 function bench_markdown4j
()
113 skip_test
"$name" && return
114 prepare_res
$outdir/markdown4j.dat
"markdown4j" "markdown4j"
115 for file in $bncdir/*.md
; do
116 name
=`basename $file .md`
117 bench_command
"$bench" "" "java" "-cp" "$engdir/markdown4j/.:$engdir/markdown4j/markdown4j-2.2.jar" "Markdown4j" "$file" "$s"
122 function bench_pandoc
()
125 skip_test
"$name" && return
126 prepare_res
$outdir/pandoc.dat
"pandoc" "pandoc"
127 for file in $bncdir/*.md
; do
128 name
=`basename $file .md`
129 bench_command
"$bench" "" "$engdir/pandoc/pandoc" "$file" "$s"
134 if test "$#" -gt
0; then
135 plot
$outdir/bench_markdown.gnu
138 if test -n
"$died"; then
139 echo "Some commands failed"