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 p"
34 echo " sort_vertices: sort the vertices of the polygon"
35 echo " - usage : sort_vertices p"
36 echo " intersection: bench the intersection between two polygons"
37 echo " - usage : intersection p"
38 echo " convex_hull: bench creating the convex hull of a set of points"
39 echo " - usage : convex_hull p"
40 echo " convexity : bench the verification of the convexity of a polygon"
41 echo " - usage : convexity p"
42 echo " contain : bench the point in polygon check"
43 echo " - usage : contain p"
47 function bench_add_vertex
()
49 if [ -d add_vertex
]; then
56 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
58 prepare_res add_vertex.out add_vertex add_vertex
60 bench_command add_vertex add_vertex .
/bench_polygon
-m add_vertex
--nbpts $
((points
/ 2))
63 function bench_sorting
()
65 if [ -d sort_vertices
]; then
72 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
74 prepare_res sort_vertices.out sort_vertex sort_vertices
76 bench_command sort_vertices sort_vertices .
/bench_polygon
-m sort_vertices
--nbpts $
((points
* 20))
79 function bench_intersection
()
81 if [ -d intersection
]; then
88 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
90 prepare_res intersection.out intersection intersection
92 bench_command intersection intersection .
/bench_polygon
-m intersection
--nbpts $
((points
/ 10))
95 function bench_convex_hull
()
97 if [ -d convex_hull
]; then
104 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
106 prepare_res convex_hull.out convex_hull convex_hull
108 bench_command convex_hull convex_hull .
/bench_polygon
-m convex_hull
--nbpts $
((points
* 30))
111 function bench_convexity
()
113 if [ -d convexity
]; then
120 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
122 prepare_res convexity.out convexity convexity
124 bench_command convexity convexity .
/bench_polygon
-m is_convex
--nbpts $
((points
* 40))
128 function bench_contain
()
130 if [ -d contain
]; then
137 ..
/..
/..
/..
/bin
/nitc
--global ..
/bench_polygon.nit
139 prepare_res contain.out contain contain
141 bench_command contain contain .
/bench_polygon
-m contain
--nbpts $
((points
* 50))
146 while [ "$stop" = false
]; do
149 -n
) count
="$2"; shift; shift;;
150 -p
) points
="$2"; shift;shift;;
155 if test $# -lt
1; then
161 add_vertex
) shift; bench_add_vertex $@
;;
162 sort_vertices
) shift; bench_sorting $@
;;
163 intersection
) shift; bench_intersection $@
;;
164 convex_hull
) shift; bench_convex_hull $@
;;
165 convexity
) shift; bench_convexity $@
;;
166 contain
) shift; bench_contain $@
;;
170 if test -n
"$died"; then
171 echo "Some commands failed"