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;
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;
122 struct GNUNET_PeerIdentity peer_id;
123 double pref_abs[GNUNET_ATS_PreferenceCount];
124 double pref_norm[GNUNET_ATS_PreferenceCount];
126 struct LoggingAddress *addr_head;
127 struct LoggingAddress *addr_tail;
130 struct LoggingAddress
132 struct LoggingAddress *next;
133 struct LoggingAddress *prev;
138 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_in;
139 struct GNUNET_BANDWIDTH_Value32NBO assigned_bw_out;
141 double prop_abs[GNUNET_ATS_PropertyCount];
142 double prop_norm[GNUNET_ATS_PropertyCount];
148 struct TestPeer *prev;
149 struct TestPeer *next;
152 struct GNUNET_PeerIdentity peer_id;
154 double pref_abs[GNUNET_ATS_PreferenceCount];
155 double pref_norm[GNUNET_ATS_PreferenceCount];
157 struct TestAddress *addr_head;
158 struct TestAddress *addr_tail;
164 struct TestAddress *next;
165 struct TestAddress *prev;
168 struct ATS_Address *ats_addr;
170 double prop_abs[GNUNET_ATS_PropertyCount];
171 double prop_norm[GNUNET_ATS_PropertyCount];
178 typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (
181 typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e,
182 struct GNUNET_TIME_Relative duration,int success);
185 * An operation in an experiment
187 struct GNUNET_ATS_TEST_Operation
189 struct GNUNET_ATS_TEST_Operation *next;
190 struct GNUNET_ATS_TEST_Operation *prev;
192 long long unsigned int address_id;
193 long long unsigned int peer_id;
194 long long unsigned int client_id;
195 long long unsigned int address_session;
196 long long unsigned int address_network;
201 long long unsigned int base_rate;
202 long long unsigned int max_rate;
203 struct GNUNET_TIME_Relative period;
204 struct GNUNET_TIME_Relative frequency;
206 enum OperationType type;
207 enum GeneratorType gen_type;
208 enum GNUNET_ATS_PreferenceKind pref_type;
209 enum GNUNET_ATS_Property prop_type;
215 struct Episode *next;
216 struct GNUNET_TIME_Relative duration;
218 struct GNUNET_ATS_TEST_Operation *head;
219 struct GNUNET_ATS_TEST_Operation *tail;
224 GNUNET_SCHEDULER_TaskIdentifier logging_task;
225 struct GNUNET_TIME_Relative log_freq;
227 /* DLL list for logging time steps */
228 struct LoggingTimeStep *head;
229 struct LoggingTimeStep *tail;
237 struct GNUNET_TIME_Relative log_freq;
238 struct GNUNET_TIME_Relative max_duration;
239 struct GNUNET_TIME_Relative total_duration;
240 struct GNUNET_TIME_Absolute start_time;
241 unsigned int num_episodes;
242 struct Episode *start;
244 struct GNUNET_CONFIGURATION_Handle *cfg;
246 GNUNET_SCHEDULER_TaskIdentifier experiment_timeout_task;
247 GNUNET_SCHEDULER_TaskIdentifier episode_timeout_task;
250 GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb;
251 GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
254 struct PreferenceGenerator
256 struct PreferenceGenerator *prev;
257 struct PreferenceGenerator *next;
259 enum GeneratorType type;
262 unsigned int client_id;
264 enum GNUNET_ATS_PreferenceKind kind;
268 struct GNUNET_TIME_Relative duration_period;
269 struct GNUNET_TIME_Relative frequency;
271 GNUNET_SCHEDULER_TaskIdentifier set_task;
272 struct GNUNET_TIME_Absolute next_ping_transmission;
273 struct GNUNET_TIME_Absolute time_start;
277 struct PropertyGenerator
279 struct PropertyGenerator *prev;
280 struct PropertyGenerator *next;
282 enum GeneratorType type;
285 unsigned int address_id;
287 struct TestPeer *test_peer;
288 struct TestAddress *test_address;
289 uint32_t ats_property;
293 struct GNUNET_TIME_Relative duration_period;
294 struct GNUNET_TIME_Relative frequency;
296 GNUNET_SCHEDULER_TaskIdentifier set_task;
297 struct GNUNET_TIME_Absolute next_ping_transmission;
298 struct GNUNET_TIME_Absolute time_start;
301 #endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */
302 /* end of file ats-testing.h */