-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstress.sh
executable file
·172 lines (154 loc) · 4.17 KB
/
stress.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/usr/bin/env bash
welcome() {
printf "%s" "\
_/_/_/ _/_/_/_/_/ _/_/_/ _/_/_/_/ _/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/ _/
_/_/ _/ _/_/_/ _/_/_/ _/_/ _/_/
_/ _/ _/ _/ _/ _/ _/
_/_/_/ _/ _/ _/ _/_/_/_/ _/_/_/ _/_/_/
_/_/_/_/_/ _/_/_/_/ _/_/_/ _/_/_/_/_/ _/_/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/ _/
_/ _/_/_/ _/_/ _/ _/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/ _/
_/ _/_/_/_/ _/_/_/ _/ _/_/_/_/ _/ _/
version 0.3: Mozzarella
This script generates a series of dummy data and sends it to all methods, then it generates a series of points
that will later be plot using gnuplot
Options:
--path-tester -- parse the path of the folder containing the data (F_i_j.txt)
--params | -p -- parameters for stress testers:
n -> The number of companies
m -> The number of crime events
isize -> The initial size for experimentations
fsize -> The final size for experimentation
istep -> The increment of sizes
rep -> The number of repetitions for a each size
--default | -d -- automatically run Stress tester with default parameters
--plot | -g -- plot data using gnuplot
--save | -s -- save all output data
--help | -h -- display this help and exit
"
exit 1
}
default_path_to_save="$HOME/Documents/"
stress_file_name="stress.csv" #
path_tester="default" #
graph="false" #
if [[ "$1" == "" ]] ; then
welcome
fi
while test $# -gt 0; do
case "$1" in
-h|--help)
welcome
;;
-p|--params)
shift
case "$1" in # n
''|*[!0-9]*)
printf "Please enter a positive Integer: n"
exit 1
;;
*)
n="$1"
;;
esac
case "$2" in # m
''|*[!0-9]*)
printf "Please enter a positive Integer: m"
exit 1
;;
*)
m="$2"
;;
esac
case "$3" in # isize
''|*[!0-9]*)
printf "Please enter a positive Integer: initial size"
exit 1
;;
*)
isize="$3"
;;
esac
case "$4" in # fsize
''|*[!0-9]*)
printf "Please enter a positive Integer: final size"
exit 1
;;
*)
fsize="$4"
;;
esac
case "$5" in # n
''|*[!0-9]*)
printf "Please enter a positive Integer: increments of the size (Δx)"
exit 1
;;
*)
istep="$5"
;;
esac
case "$6" in # rep
''|*[!0-9]*)
printf "Please enter a positive Integer: number of repetitions of each size"
exit 1
;;
*)
rep="$6"
;;
esac
shift
;;
-d|--default)
# Default Values
shift
n=10
m=50
isize=50
fsize=1000
istep=50
rep=200
;;
-g|--plot)
shift
graph="true"
;;
--path-tester)
shift
if test $# -gt 0; then
path_tester="$1"
elif [[ "$1" == " " ]] ; then
path_tester="default"
fi
shift
;;
-s|--save)
save_me="save"
shift
if test $# -gt 0; then
case "$1" in
*/) path_to_save="$1"
break
;;
*) path_to_save="$1"/
break
;;
esac
else
path_to_save="$default_path_to_save"
fi
shift
;;
*)
break
;;
esac
done
stress_me() {
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
java -Dfile.encoding=UTF-8 -classpath "$DIR"/out/production/Solve p1MainClasses.Stress "$n,$m,$isize,$fsize,$istep,$rep" $graph $path_tester "$save_me,$path_to_save,$stress_file_name"
exit 1
}
# Fire the torture!!!
stress_me