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 source ..
/..
/bench_common.sh
17 source ..
/..
/bench_plot.sh
19 # Default number of times a command must be run with bench_command
20 # Can be overrided with 'the option -n'
26 echo "run_bench: [options]* bench_name args"
27 echo " -n count: number of execution for each bar (default: $count)"
28 echo " -p points: number of points used for the polygons (default: $points)"
32 echo " add_vertex: bench adding vertex in a polygon"
33 echo " - usage : add_vertex nbpts"
34 echo " sort_vertices: sort the vertices of the polygon"
35 echo " - usage : sort_vertices nbpts"
36 echo " intersection: bench the intersection between two polygons"
37 echo " - usage : intersection nbpts"
38 echo " convex_hull: bench creating the convex hull of a set of points"
39 echo " - usage : convex_hull nbpts"
40 echo " convexity : bench the verification of the convexity of a polygon"
41 echo " - usage : convexity nbpts"
42 echo " contain : bench the point in polygon check"
43 echo " - usage : contain nbpts"
47 function bench_add_vertex
()
49 if [ -d add_vertex
]; then
57 javac ..
/code
/*.java
-d .
59 prepare_res add_vertex.out add_vertex add_vertex
61 bench_command add_vertex add_vertex java BenchPolygon add_vertex $
((points
/ 2))
64 function bench_sorting
()
66 if [ -d sort_vertices
]; then
73 javac ..
/code
/*.java
-d .
75 prepare_res sort_vertices.out sort_vertex sort_vertices
77 bench_command sort_vertices sort_vertices java BenchPolygon sort_vertices $
((points
* 20))
81 function bench_intersection
()
83 if [ -d intersection
]; then
90 javac ..
/code
/*.java
-d .
92 prepare_res intersection.out intersection intersection
94 bench_command intersection intersection java BenchPolygon intersection $
((points
/ 10))
97 function bench_convex_hull
()
99 echo Bench way too long
, skipping it
103 if [ -d convex_hull
]; then
110 javac ..
/code
/*.java
-d .
112 prepare_res convex_hull.out convex_hull convex_hull
114 bench_command convex_hull convex_hull java BenchPolygon convex_hull $
((points
* 30))
117 function bench_convexity
()
119 if [ -d convexity
]; then
126 javac ..
/code
/*.java
-d .
128 prepare_res convexity.out convexity convexity
130 bench_command convexity convexity java BenchPolygon convexity $
((points
* 40))
134 function bench_contain
()
136 if [ -d contain
]; then
143 javac ..
/code
/*.java
-d .
145 prepare_res contain.out contain contain
147 bench_command contain contain java BenchPolygon contain $
((points
* 50))
151 while [ "$stop" = false
]; do
154 -n
) count
="$2"; shift; shift;;
155 -p
) points
="$2"; shift;shift;;
160 if test $# -lt
1; then
166 add_vertex
) shift; bench_add_vertex $@
;;
167 sort_vertices
) shift; bench_sorting $@
;;
168 intersection
) shift; bench_intersection $@
;;
169 convex_hull
) shift; bench_convex_hull $@
;;
170 convexity
) shift; bench_convexity $@
;;
171 contain
) shift; bench_contain $@
;;