2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file ats-tests/ats-testing-experiment.c
22 * @brief ats benchmark: controlled experiment execution
23 * @author Christian Grothoff
24 * @author Matthias Wachs
26 #ifndef GNUNET_ATS_SOLVER_EVAL_H
27 #define GNUNET_ATS_SOLVER_EVAL_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"
39 GNUNET_ATS_TEST_TG_LINEAR,
40 GNUNET_ATS_TEST_TG_CONSTANT,
41 GNUNET_ATS_TEST_TG_RANDOM,
42 GNUNET_ATS_TEST_TG_SINUS
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,
68 struct GNUNET_ATS_PluginEnvironment env;
78 struct GNUNET_CONTAINER_MultiPeerMap *addresses;
81 enum GNUNET_ATS_Solvers
83 GNUNET_ATS_SOLVER_PROPORTIONAL,
84 GNUNET_ATS_SOLVER_MLP,
85 GNUNET_ATS_SOLVER_RIL,
88 struct LoggingFileHandle
90 /* DLL list for logging time steps */
91 struct LoggingFileHandle *next;
92 struct LoggingFileHandle *prev;
95 long long unsigned int pid;
98 long long unsigned int aid;
100 struct GNUNET_DISK_FileHandle *f_hd;
104 struct LoggingTimeStep
106 struct LoggingTimeStep *prev;
107 struct LoggingTimeStep *next;
109 struct LoggingPeer *head;
110 struct LoggingPeer *tail;
112 struct GNUNET_TIME_Absolute timestamp;
113 struct GNUNET_TIME_Relative delta;
118 struct LoggingPeer *prev;
119 struct LoggingPeer *next;
121 long long unsigned int id;
122 struct GNUNET_PeerIdentity peer_id;
123 double pref_abs[GNUNET_ATS_PreferenceCount];
124 double pref_norm[GNUNET_ATS_PreferenceCount];
127 struct LoggingAddress *addr_head;
128 struct LoggingAddress *addr_tail;
131 struct LoggingAddress
133 struct LoggingAddress *next;
134 struct LoggingAddress *prev;
136 long long unsigned int aid;
140 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in;
141 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out;
143 double prop_abs[GNUNET_ATS_PropertyCount];
144 double prop_norm[GNUNET_ATS_PropertyCount];
150 struct TestPeer *prev;
151 struct TestPeer *next;
154 long long unsigned int id;
156 struct GNUNET_PeerIdentity peer_id;
158 double pref_abs[GNUNET_ATS_PreferenceCount];
159 double pref_norm[GNUNET_ATS_PreferenceCount];
161 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in;
162 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out;
164 struct TestAddress *addr_head;
165 struct TestAddress *addr_tail;
171 struct TestAddress *next;
172 struct TestAddress *prev;
174 long long unsigned int aid;
175 struct ATS_Address *ats_addr;
178 double prop_abs[GNUNET_ATS_PropertyCount];
179 double prop_norm[GNUNET_ATS_PropertyCount];
186 typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (
189 typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e,
190 struct GNUNET_TIME_Relative duration,int success);
193 * An operation in an experiment
195 struct GNUNET_ATS_TEST_Operation
197 struct GNUNET_ATS_TEST_Operation *next;
198 struct GNUNET_ATS_TEST_Operation *prev;
200 long long unsigned int address_id;
201 long long unsigned int peer_id;
202 long long unsigned int client_id;
204 long long unsigned int address_session;
205 unsigned int address_network;
210 long long unsigned int base_rate;
211 long long unsigned int max_rate;
212 struct GNUNET_TIME_Relative period;
213 struct GNUNET_TIME_Relative frequency;
214 struct GNUNET_TIME_Relative feedback_delay;
216 enum OperationType type;
217 enum GeneratorType gen_type;
218 enum GNUNET_ATS_PreferenceKind pref_type;
219 enum GNUNET_ATS_Property prop_type;
225 struct Episode *next;
226 struct GNUNET_TIME_Relative duration;
228 struct GNUNET_ATS_TEST_Operation *head;
229 struct GNUNET_ATS_TEST_Operation *tail;
234 GNUNET_SCHEDULER_TaskIdentifier logging_task;
235 struct GNUNET_TIME_Relative log_freq;
237 /* DLL list for logging time steps */
238 struct LoggingTimeStep *head;
239 struct LoggingTimeStep *tail;
247 char *log_output_dir;
248 int log_append_time_stamp;
250 struct GNUNET_TIME_Relative log_freq;
251 struct GNUNET_TIME_Relative max_duration;
252 struct GNUNET_TIME_Relative total_duration;
253 struct GNUNET_TIME_Absolute start_time;
254 unsigned int num_episodes;
255 struct Episode *start;
257 struct GNUNET_CONFIGURATION_Handle *cfg;
259 GNUNET_SCHEDULER_TaskIdentifier experiment_timeout_task;
260 GNUNET_SCHEDULER_TaskIdentifier episode_timeout_task;
263 GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb;
264 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
267 struct PreferenceGenerator
269 struct PreferenceGenerator *prev;
270 struct PreferenceGenerator *next;
272 enum GeneratorType type;
274 long long unsigned int peer;
275 unsigned int client_id;
277 enum GNUNET_ATS_PreferenceKind kind;
281 struct GNUNET_TIME_Relative duration_period;
282 struct GNUNET_TIME_Relative frequency;
283 struct GNUNET_TIME_Relative feedback_frequency;
285 GNUNET_SCHEDULER_TaskIdentifier set_task;
286 GNUNET_SCHEDULER_TaskIdentifier feedback_task;
287 struct GNUNET_TIME_Absolute next_ping_transmission;
288 struct GNUNET_TIME_Absolute time_start;
292 uint32_t feedback_bw_out_acc;
293 uint32_t feedback_bw_in_acc;
294 uint32_t feedback_delay_acc;
297 double pref_latency_old;
299 struct GNUNET_TIME_Absolute feedback_last;
301 struct GNUNET_TIME_Absolute feedback_last_bw_update;
302 struct GNUNET_TIME_Absolute feedback_last_delay_update;
303 uint32_t last_assigned_bw_in;
304 uint32_t last_assigned_bw_out;
305 double last_delay_value;
310 struct PropertyGenerator
312 struct PropertyGenerator *prev;
313 struct PropertyGenerator *next;
315 enum GeneratorType type;
317 long long unsigned int peer;
318 long long unsigned int address_id;
320 struct TestPeer *test_peer;
321 struct TestAddress *test_address;
322 uint32_t ats_property;
326 struct GNUNET_TIME_Relative duration_period;
327 struct GNUNET_TIME_Relative frequency;
329 GNUNET_SCHEDULER_TaskIdentifier set_task;
330 struct GNUNET_TIME_Absolute next_ping_transmission;
331 struct GNUNET_TIME_Absolute time_start;
334 #endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */
335 /* end of file ats-testing.h */