diff options
Diffstat (limited to 'src/ats/gnunet-ats-solver-eval.h')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 335 |
1 files changed, 0 insertions, 335 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h deleted file mode 100644 index 7d14bf761..000000000 --- a/src/ats/gnunet-ats-solver-eval.h +++ /dev/null | |||
@@ -1,335 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2010-2013 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file ats-tests/ats-testing-experiment.c | ||
22 | * @brief ats benchmark: controlled experiment execution | ||
23 | * @author Christian Grothoff | ||
24 | * @author Matthias Wachs | ||
25 | */ | ||
26 | #ifndef GNUNET_ATS_SOLVER_EVAL_H | ||
27 | #define GNUNET_ATS_SOLVER_EVAL_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_ats_plugin.h" | ||
32 | #include "gnunet_ats_service.h" | ||
33 | #include "gnunet-service-ats_addresses.h" | ||
34 | #include "gnunet-service-ats_normalization.h" | ||
35 | #include "test_ats_api_common.h" | ||
36 | |||
37 | enum GeneratorType | ||
38 | { | ||
39 | GNUNET_ATS_TEST_TG_LINEAR, | ||
40 | GNUNET_ATS_TEST_TG_CONSTANT, | ||
41 | GNUNET_ATS_TEST_TG_RANDOM, | ||
42 | GNUNET_ATS_TEST_TG_SINUS | ||
43 | }; | ||
44 | |||
45 | |||
46 | enum OperationType | ||
47 | { | ||
48 | SOLVER_OP_ADD_ADDRESS, | ||
49 | SOLVER_OP_DEL_ADDRESS, | ||
50 | SOLVER_OP_START_SET_PROPERTY, | ||
51 | SOLVER_OP_STOP_SET_PROPERTY, | ||
52 | SOLVER_OP_START_SET_PREFERENCE, | ||
53 | SOLVER_OP_STOP_SET_PREFERENCE, | ||
54 | SOLVER_OP_START_REQUEST, | ||
55 | SOLVER_OP_STOP_REQUEST, | ||
56 | }; | ||
57 | |||
58 | struct SolverHandle | ||
59 | { | ||
60 | /** | ||
61 | * Solver plugin name | ||
62 | */ | ||
63 | char *plugin; | ||
64 | |||
65 | /** | ||
66 | * Solver environment | ||
67 | */ | ||
68 | struct GNUNET_ATS_PluginEnvironment env; | ||
69 | |||
70 | /** | ||
71 | * Solver handle | ||
72 | */ | ||
73 | struct GNUNET_ATS_SolverFunctions *sf; | ||
74 | |||
75 | /** | ||
76 | * Address hashmap | ||
77 | */ | ||
78 | struct GNUNET_CONTAINER_MultiPeerMap *addresses; | ||
79 | }; | ||
80 | |||
81 | enum GNUNET_ATS_Solvers | ||
82 | { | ||
83 | GNUNET_ATS_SOLVER_PROPORTIONAL, | ||
84 | GNUNET_ATS_SOLVER_MLP, | ||
85 | GNUNET_ATS_SOLVER_RIL, | ||
86 | }; | ||
87 | |||
88 | struct LoggingFileHandle | ||
89 | { | ||
90 | /* DLL list for logging time steps */ | ||
91 | struct LoggingFileHandle *next; | ||
92 | struct LoggingFileHandle *prev; | ||
93 | |||
94 | /* peer id */ | ||
95 | long long unsigned int pid; | ||
96 | |||
97 | /* address id */ | ||
98 | long long unsigned int aid; | ||
99 | |||
100 | struct GNUNET_DISK_FileHandle *f_hd; | ||
101 | }; | ||
102 | |||
103 | struct LoggingTimeStep | ||
104 | { | ||
105 | struct LoggingTimeStep *prev; | ||
106 | struct LoggingTimeStep *next; | ||
107 | |||
108 | struct LoggingPeer *head; | ||
109 | struct LoggingPeer *tail; | ||
110 | |||
111 | struct GNUNET_TIME_Absolute timestamp; | ||
112 | struct GNUNET_TIME_Relative delta; | ||
113 | }; | ||
114 | |||
115 | struct LoggingPeer | ||
116 | { | ||
117 | struct LoggingPeer *prev; | ||
118 | struct LoggingPeer *next; | ||
119 | |||
120 | long long unsigned int id; | ||
121 | struct GNUNET_PeerIdentity peer_id; | ||
122 | double pref_abs[GNUNET_ATS_PREFERENCE_END]; | ||
123 | double pref_norm[GNUNET_ATS_PREFERENCE_END]; | ||
124 | int is_requested; | ||
125 | |||
126 | struct LoggingAddress *addr_head; | ||
127 | struct LoggingAddress *addr_tail; | ||
128 | }; | ||
129 | |||
130 | struct LoggingAddress | ||
131 | { | ||
132 | struct LoggingAddress *next; | ||
133 | struct LoggingAddress *prev; | ||
134 | |||
135 | long long unsigned int aid; | ||
136 | int active; | ||
137 | uint32_t network; | ||
138 | uint32_t assigned_bw_in; | ||
139 | uint32_t assigned_bw_out; | ||
140 | |||
141 | double prop_abs[GNUNET_ATS_PropertyCount]; | ||
142 | double prop_norm[GNUNET_ATS_PropertyCount]; | ||
143 | }; | ||
144 | |||
145 | |||
146 | struct TestPeer | ||
147 | { | ||
148 | struct TestPeer *prev; | ||
149 | struct TestPeer *next; | ||
150 | |||
151 | |||
152 | long long unsigned int id; | ||
153 | int is_requested; | ||
154 | struct GNUNET_PeerIdentity peer_id; | ||
155 | |||
156 | double pref_abs[GNUNET_ATS_PreferenceCount]; | ||
157 | double pref_norm[GNUNET_ATS_PreferenceCount]; | ||
158 | |||
159 | uint32_t assigned_bw_in; | ||
160 | uint32_t assigned_bw_out; | ||
161 | |||
162 | struct TestAddress *addr_head; | ||
163 | struct TestAddress *addr_tail; | ||
164 | }; | ||
165 | |||
166 | |||
167 | struct TestAddress | ||
168 | { | ||
169 | struct TestAddress *next; | ||
170 | struct TestAddress *prev; | ||
171 | |||
172 | long long unsigned int aid; | ||
173 | struct ATS_Address *ats_addr; | ||
174 | uint32_t network; | ||
175 | |||
176 | double prop_abs[GNUNET_ATS_PropertyCount]; | ||
177 | double prop_norm[GNUNET_ATS_PropertyCount]; | ||
178 | }; | ||
179 | |||
180 | struct Episode; | ||
181 | |||
182 | struct Experiment; | ||
183 | |||
184 | typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) ( | ||
185 | struct Episode *e); | ||
186 | |||
187 | typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e, | ||
188 | struct | ||
189 | GNUNET_TIME_Relative | ||
190 | duration, int | ||
191 | success); | ||
192 | |||
193 | /** | ||
194 | * An operation in an experiment | ||
195 | */ | ||
196 | struct GNUNET_ATS_TEST_Operation | ||
197 | { | ||
198 | struct GNUNET_ATS_TEST_Operation *next; | ||
199 | struct GNUNET_ATS_TEST_Operation *prev; | ||
200 | |||
201 | long long unsigned int address_id; | ||
202 | long long unsigned int peer_id; | ||
203 | long long unsigned int client_id; | ||
204 | |||
205 | long long unsigned int address_session; | ||
206 | unsigned int address_network; | ||
207 | char*address; | ||
208 | char*plugin; | ||
209 | |||
210 | |||
211 | long long unsigned int base_rate; | ||
212 | long long unsigned int max_rate; | ||
213 | struct GNUNET_TIME_Relative period; | ||
214 | struct GNUNET_TIME_Relative frequency; | ||
215 | struct GNUNET_TIME_Relative feedback_delay; | ||
216 | |||
217 | enum OperationType type; | ||
218 | enum GeneratorType gen_type; | ||
219 | enum GNUNET_ATS_PreferenceKind pref_type; | ||
220 | // enum GNUNET_ATS_Property prop_type; | ||
221 | }; | ||
222 | |||
223 | struct Episode | ||
224 | { | ||
225 | int id; | ||
226 | struct Episode *next; | ||
227 | struct GNUNET_TIME_Relative duration; | ||
228 | |||
229 | struct GNUNET_ATS_TEST_Operation *head; | ||
230 | struct GNUNET_ATS_TEST_Operation *tail; | ||
231 | }; | ||
232 | |||
233 | struct LoggingHandle | ||
234 | { | ||
235 | struct GNUNET_SCHEDULER_Task *logging_task; | ||
236 | struct GNUNET_TIME_Relative log_freq; | ||
237 | |||
238 | /* DLL list for logging time steps */ | ||
239 | struct LoggingTimeStep *head; | ||
240 | struct LoggingTimeStep *tail; | ||
241 | }; | ||
242 | |||
243 | struct Experiment | ||
244 | { | ||
245 | char *name; | ||
246 | char *log_prefix; | ||
247 | char *cfg_file; | ||
248 | char *log_output_dir; | ||
249 | int log_append_time_stamp; | ||
250 | |||
251 | struct GNUNET_TIME_Relative log_freq; | ||
252 | struct GNUNET_TIME_Relative max_duration; | ||
253 | struct GNUNET_TIME_Relative total_duration; | ||
254 | struct GNUNET_TIME_Absolute start_time; | ||
255 | unsigned int num_episodes; | ||
256 | struct Episode *start; | ||
257 | |||
258 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
259 | |||
260 | struct GNUNET_SCHEDULER_Task *experiment_timeout_task; | ||
261 | struct GNUNET_SCHEDULER_Task *episode_timeout_task; | ||
262 | struct Episode *cur; | ||
263 | |||
264 | GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb; | ||
265 | GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb; | ||
266 | }; | ||
267 | |||
268 | struct PreferenceGenerator | ||
269 | { | ||
270 | struct PreferenceGenerator *prev; | ||
271 | struct PreferenceGenerator *next; | ||
272 | |||
273 | enum GeneratorType type; | ||
274 | |||
275 | long long unsigned int peer; | ||
276 | unsigned int client_id; | ||
277 | |||
278 | enum GNUNET_ATS_PreferenceKind kind; | ||
279 | |||
280 | long int base_value; | ||
281 | long int max_value; | ||
282 | struct GNUNET_TIME_Relative duration_period; | ||
283 | struct GNUNET_TIME_Relative frequency; | ||
284 | struct GNUNET_TIME_Relative feedback_frequency; | ||
285 | |||
286 | struct GNUNET_SCHEDULER_Task *set_task; | ||
287 | struct GNUNET_SCHEDULER_Task *feedback_task; | ||
288 | struct GNUNET_TIME_Absolute next_ping_transmission; | ||
289 | struct GNUNET_TIME_Absolute time_start; | ||
290 | |||
291 | |||
292 | /* Feedback */ | ||
293 | uint32_t feedback_bw_out_acc; | ||
294 | uint32_t feedback_bw_in_acc; | ||
295 | uint32_t feedback_delay_acc; | ||
296 | |||
297 | double pref_bw_old; | ||
298 | double pref_latency_old; | ||
299 | |||
300 | struct GNUNET_TIME_Absolute feedback_last; | ||
301 | |||
302 | struct GNUNET_TIME_Absolute feedback_last_bw_update; | ||
303 | struct GNUNET_TIME_Absolute feedback_last_delay_update; | ||
304 | uint32_t last_assigned_bw_in; | ||
305 | uint32_t last_assigned_bw_out; | ||
306 | double last_delay_value; | ||
307 | }; | ||
308 | |||
309 | |||
310 | struct PropertyGenerator | ||
311 | { | ||
312 | struct PropertyGenerator *prev; | ||
313 | struct PropertyGenerator *next; | ||
314 | |||
315 | enum GeneratorType type; | ||
316 | |||
317 | long long unsigned int peer; | ||
318 | long long unsigned int address_id; | ||
319 | |||
320 | struct TestPeer *test_peer; | ||
321 | struct TestAddress *test_address; | ||
322 | uint32_t ats_property; | ||
323 | |||
324 | long int base_value; | ||
325 | long int max_value; | ||
326 | struct GNUNET_TIME_Relative duration_period; | ||
327 | struct GNUNET_TIME_Relative frequency; | ||
328 | |||
329 | struct GNUNET_SCHEDULER_Task *set_task; | ||
330 | struct GNUNET_TIME_Absolute next_ping_transmission; | ||
331 | struct GNUNET_TIME_Absolute time_start; | ||
332 | }; | ||
333 | |||
334 | #endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */ | ||
335 | /* end of file ats-testing.h */ | ||