GNUnet  0.10.x
ats-testing.h
Go to the documentation of this file.
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  */
26 #include "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "gnunet_testbed_service.h"
29 #include "gnunet_ats_service.h"
30 #include "gnunet_core_service.h"
32 
33 #define TEST_ATS_PREFERENCE_DEFAULT 1.0
34 
38 #define TEST_MESSAGE_TYPE_PING 12345
39 
43 #define TEST_MESSAGE_TYPE_PONG 12346
44 
48 #define TEST_MESSAGE_SIZE 100
49 
50 
51 struct TestMessage {
53 
54  uint8_t padding[TEST_MESSAGE_SIZE - sizeof(struct GNUNET_MessageHeader)];
55 };
56 
57 
58 struct BenchmarkPartner;
59 
60 struct BenchmarkPeer;
61 
63 
64 struct TrafficGenerator;
65 
66 struct LoggingHandle;
67 
73 };
74 
75 
84  void *cls,
85  struct BenchmarkPeer *masters,
86  struct BenchmarkPeer *slaves);
87 
98 typedef void (*GNUNET_ATS_TEST_LogRequest) (
99  void *cls,
100  const struct GNUNET_HELLO_Address *address,
101  int address_active,
102  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
103  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
104  const struct GNUNET_ATS_Properties *prop);
105 
114 
118  int no;
119 
123  int master;
124 
129 
134 
139 
144 
149 
155 
160 
165 
171 
177 
182  double pref_value;
183 
189 
194 
199 
205 
209  unsigned int total_messages_sent;
210 
214  unsigned int total_bytes_sent;
215 
220 
224  unsigned int total_bytes_received;
225 };
226 
230 
232 
235 
236  long int base_rate;
237  long int max_rate;
238  struct GNUNET_TIME_Relative duration_period;
239 
241  struct GNUNET_TIME_Absolute next_ping_transmission;
242  struct GNUNET_TIME_Absolute time_start;
243 };
244 
245 
246 struct PreferenceGenerator {
247  struct PreferenceGenerator *prev;
248  struct PreferenceGenerator *next;
249 
250  enum GeneratorType type;
251 
254 
255  enum GNUNET_ATS_PreferenceKind kind;
256 
257  long int base_value;
258  long int max_value;
259  struct GNUNET_TIME_Relative duration_period;
260  struct GNUNET_TIME_Relative frequency;
261 
262  struct GNUNET_SCHEDULER_Task *set_task;
263  struct GNUNET_TIME_Absolute next_ping_transmission;
264  struct GNUNET_TIME_Absolute time_start;
265 };
266 
274  struct BenchmarkPeer *me;
275 
280 
285 
290 
295 
299  struct GNUNET_TIME_Absolute last_message_sent;
300 
304  unsigned int total_app_rtt;
305 
309  unsigned int messages_sent;
310 
314  unsigned int bytes_sent;
315 
319  unsigned int messages_received;
320 
324  unsigned int bytes_received;
325 
330 
334  uint32_t bandwidth_in;
335 
339  uint32_t bandwidth_out;
340 
345 
349  double pref_delay;
350 };
351 
352 
361 
366 
371 
376 
381 };
382 
383 
389 
393  int result;
394 
399 
403  char *solver;
404 
408  char *testname;
409 
413  char *pref_str;
414 
418  int pref_val;
419 
423  unsigned int num_masters;
424 
429 
433  unsigned int num_slaves;
434 
439 
443  struct GNUNET_TIME_Relative perf_duration;
444 
448  struct GNUNET_TIME_Relative log_frequency;
449 
454 
456 
458 
459  void *done_cb_cls;
460 };
461 
467 };
468 
469 struct Episode;
470 
471 struct Experiment;
472 
474 
476  struct Experiment *e,
478  int success);
479 
486 
487  long long unsigned int src_id;
488  long long unsigned int dest_id;
489 
490  long long unsigned int base_rate;
491  long long unsigned int max_rate;
492  struct GNUNET_TIME_Relative period;
493  struct GNUNET_TIME_Relative frequency;
494 
495  enum OperationType type;
496  enum GeneratorType gen_type;
497  enum GNUNET_ATS_PreferenceKind pref_type;
498 };
499 
500 struct Episode {
501  int id;
502  struct Episode *next;
504 
507 };
508 
509 
510 struct Experiment {
511  char *name;
512  char *cfg_file;
513  unsigned long long int num_masters;
514  unsigned long long int num_slaves;
515  struct GNUNET_TIME_Relative log_freq;
516  struct GNUNET_TIME_Relative max_duration;
517  struct GNUNET_TIME_Relative total_duration;
519  unsigned int num_episodes;
520  struct Episode *start;
521 
522  struct GNUNET_SCHEDULER_Task *experiment_timeout_task;
523  struct GNUNET_SCHEDULER_Task *episode_timeout_task;
524  struct Episode *cur;
525 
528 };
529 
530 
531 extern struct GNUNET_CONFIGURATION_Handle *cfg;
532 
540 void
542  struct Experiment *e,
545 
546 
553 struct Experiment *
555 
556 
562 void
564 
565 
566 void
568 
569 
570 void
572 
573 
587 struct TrafficGenerator *
589  struct BenchmarkPartner *dest,
590  enum GeneratorType type,
591  unsigned int base_rate,
592  unsigned int max_rate,
593  struct GNUNET_TIME_Relative period,
595 
596 
597 void
599 
600 
604 void
606 
607 
622 struct PreferenceGenerator *
624  struct BenchmarkPeer *src,
625  struct BenchmarkPartner *dest,
626  enum GeneratorType type,
627  unsigned int base_value,
628  unsigned int value_rate,
629  struct GNUNET_TIME_Relative period,
632 
633 
634 void
636 
637 
638 void
640 
641 
653 struct LoggingHandle *
655  const char *testname,
656  struct BenchmarkPeer *masters,
657  int num_masters,
658  int num_slaves,
659  int verbose);
660 
661 
667 void
669 
670 
676 void
678 
679 
685 void
687 
688 
696 void
698  const char *test_name,
699  int plots);
700 
701 
705 struct BenchmarkPeer *
706 GNUNET_ATS_TEST_get_peer(int src);
707 
708 
709 struct BenchmarkPartner *
710 GNUNET_ATS_TEST_get_partner(int src, int dest);
711 
712 
726 void
728  char *name,
729  char *cfg_file,
730  unsigned int num_slaves,
731  unsigned int num_masters,
732  int test_core,
734  void *done_cb_cls,
736 
737 
741 void
743 
744 
745 /* end of file ats-testing.h */
char * solver
Solver string.
Definition: ats-testing.h:403
struct GNUNET_ATS_TEST_Operation * next
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
Definition: ats-testing.h:214
unsigned int messages_sent
Number of messages sent to this partner.
Definition: ats-testing.h:309
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:224
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:398
void GNUNET_ATS_TEST_experimentation_stop(struct Experiment *e)
Stop an experiment.
struct PreferenceGenerator * next
struct GNUNET_TESTBED_Operation * comm_op
Testbed operation to connect to core.
Definition: ats-testing.h:143
int connected_CORE
Are we connected to all slave peers on CORE level: GNUNET_YES/NO.
Definition: ats-testing.h:375
struct GNUNET_TESTBED_Operation * peer_id_op
Testbed operation to get peer information.
Definition: ats-testing.h:133
Connect peers with testbed.
Definition: ats-testing.c:33
struct Episode * next
struct TrafficGenerator * next
Definition: ats-testing.h:229
struct GNUNET_CONFIGURATION_Handle * cfg
Handle to our configuration.
Definition: ats-testing.c:50
Context for the core service connection.
Definition: core_api.c:76
unsigned long long int num_masters
Definition: ats-testing.h:513
struct TrafficGenerator * GNUNET_ATS_TEST_generate_traffic_start(struct BenchmarkPeer *src, struct BenchmarkPartner *dest, enum GeneratorType type, unsigned int base_rate, unsigned int max_rate, struct GNUNET_TIME_Relative period, struct GNUNET_TIME_Relative duration)
Generate between the source master and the partner and send traffic with a maximum rate...
struct GNUNET_TESTBED_Operation * ats_perf_op
Testbed operation to connect to ATS performance service.
Definition: ats-testing.h:138
void GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p)
char * testname
Preference string.
Definition: ats-testing.h:408
struct TrafficGenerator * prev
Definition: ats-testing.h:228
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
void GNUNET_ATS_TEST_generate_preferences_stop_all(void)
Stop all preferences generators.
void(* GNUNET_ATS_TESTING_EpisodeDoneCallback)(struct Episode *e)
Definition: ats-testing.h:473
struct BenchmarkPeer * GNUNET_ATS_TEST_get_peer(int src)
Topology related functions.
Definition: ats-testing.c:893
long int max_rate
Definition: ats-testing.h:237
struct GNUNET_CORE_Handle * ch
Core handle.
Definition: ats-testing.h:159
double pref_bandwidth
Current preference values for bandwidth.
Definition: ats-testing.h:344
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:188
struct PreferenceGenerator * pg
Handle for preference generator.
Definition: ats-testing.h:294
Overall state of the performance benchmark.
Definition: ats-testing.h:356
struct GNUNET_TRANSPORT_CoreHandle * th
Transport handle.
Definition: ats-testing.h:164
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:219
long long unsigned int src_id
Definition: ats-testing.h:487
void GNUNET_ATS_TEST_logging_stop(struct LoggingHandle *l)
Stop logging.
unsigned int bytes_received
Number of bytes received from this partner.
Definition: ats-testing.h:324
static struct Experiment * e
uint8_t padding[100 - sizeof(struct GNUNET_MessageHeader)]
Definition: ats-testing.h:54
void GNUNET_ATS_TEST_traffic_handle_pong(struct BenchmarkPartner *p)
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
struct GNUNET_SCHEDULER_Task * send_task
Definition: ats-testing.h:240
void GNUNET_ATS_TEST_logging_now(struct LoggingHandle *l)
Log all data now.
int core_connections
Number of core connections.
Definition: ats-testing.h:198
void GNUNET_ATS_TEST_logging_write_to_file(struct LoggingHandle *l, const char *test_name, int plots)
Write logging data to file.
struct BenchmarkPartner * GNUNET_ATS_TEST_get_partner(int src, int dest)
Definition: ats-testing.c:902
ATS performance characteristics for an address.
struct BenchmarkPartner * dest
Definition: ats-testing.h:234
struct GNUNET_SCHEDULER_Task * progress_task
Progress task.
Definition: ats-testing.h:388
Opaque handle to an abstract operation to be executed by the testing framework.
unsigned int total_messages_sent
Total number of messages this peer has sent.
Definition: ats-testing.h:209
double pref_value
Masters only Progress task.
Definition: ats-testing.h:182
enum GNUNET_ATS_PreferenceKind kind
struct BenchmarkPartner * dest
Definition: ats-testing.h:253
static struct LoggingHandle * l
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:289
struct GNUNET_MessageHeader header
Definition: ats-testing.h:52
int num_partners
Number of partners.
Definition: ats-testing.h:193
enum State state
current state of profiling
int no
Unique identifier.
Definition: ats-testing.h:118
int benchmarking
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:380
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
struct PreferenceGenerator * GNUNET_ATS_TEST_generate_preferences_start(struct BenchmarkPeer *src, struct BenchmarkPartner *dest, enum GeneratorType type, unsigned int base_value, unsigned int value_rate, struct GNUNET_TIME_Relative period, struct GNUNET_TIME_Relative frequency, enum GNUNET_ATS_PreferenceKind kind)
Generate between the source master and the partner and set preferences with a value depending on the ...
unsigned int total_app_rtt
Accumulated RTT for all messages.
Definition: ats-testing.h:304
void GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg)
static int verbose
uint32_t bandwidth_in
Bandwidth assigned inbound.
Definition: ats-testing.h:334
void GNUNET_ATS_TEST_create_topology(char *name, char *cfg_file, unsigned int num_slaves, unsigned int num_masters, int test_core, GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb, void *done_cb_cls, GNUNET_ATS_TEST_LogRequest ats_perf_cb)
Create a topology for ats testing.
Definition: ats-testing.c:926
Information we track for a peer in the testbed.
Definition: ats-testing.h:109
double pref_delay
Current preference values for delay.
Definition: ats-testing.h:349
struct PreferenceGenerator * prev
void GNUNET_ATS_TEST_experimentation_run(struct Experiment *e, GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb)
Execute the specified experiment.
int master
Is this peer a measter: GNUNET_YES/GNUNET_NO.
Definition: ats-testing.h:123
long long unsigned int dest_id
Definition: ats-testing.h:488
void(* GNUNET_ATS_TEST_LogRequest)(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Callback called when logging is required for the data contained.
Definition: ats-testing.h:98
long long unsigned int base_rate
unsigned long long int num_slaves
Definition: ats-testing.h:514
static char * filename
Information about a benchmarking partner.
Definition: ats-testing.h:270
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:319
struct GNUNET_ATS_PerformanceHandle * ats_perf_handle
ATS performance handle.
Definition: ats-testing.h:148
uint32_t bandwidth_out
Bandwidth assigned outbound.
Definition: ats-testing.h:339
static void ats_perf_cb(void *cls, const struct GNUNET_HELLO_Address *address, int active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
Definition: gnunet-ats.c:577
void GNUNET_ATS_TEST_shutdown_topology(void)
Shutdown topology.
Definition: ats-testing.c:964
int result
Test result.
Definition: ats-testing.h:393
static const char * cfg_file
Configuration filename.
int core_slave_connections
Masters only: Number of connections to slave peers.
Definition: ats-testing.h:204
struct LinkProperty * props
list of link properties
void GNUNET_ATS_TEST_logging_clean_up(struct LoggingHandle *l)
Stop logging.
char * pref_str
Preference string.
Definition: ats-testing.h:413
static struct GNUNET_TIME_Absolute start_time
Start time of the current round; used to determine how long one iteration takes (which influences how...
struct LoggingHandle * GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency, const char *testname, struct BenchmarkPeer *masters, int num_masters, int num_slaves, int verbose)
Start logging.
void(* GNUNET_ATS_AddressInformationCallback)(void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
Signature of a function that is called with QoS information about an address.
An operation in an experiment.
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:433
struct BenchmarkPeer * src
Definition: ats-testing.h:252
struct BenchmarkPeer * src
Definition: ats-testing.h:233
const char * name
int connected_PEERS
Are we connected to all peers: GNUNET_YES/NO.
Definition: ats-testing.h:370
struct GNUNET_ATS_TEST_Operation * prev
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:438
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:428
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
GNUNET_ATS_AddressInformationCallback ats_perf_cb
Definition: ats-testing.h:457
ATS Handle to obtain and/or modify performance information.
Handle to a message queue.
Definition: mq.c:84
struct GNUNET_SCHEDULER_Task * ats_task
Masters only Progress task.
Definition: ats-testing.h:176
The identity of the host (wraps the signing key of the peer).
unsigned int bytes_sent
Number of bytes sent to this partner.
Definition: ats-testing.h:314
struct GNUNET_MQ_Handle * mq
Message queue handle.
Definition: ats-testing.h:284
configuration data
Definition: configuration.c:83
static struct PendingResolutions * head
Head of list of pending resolution requests.
Definition: gnunet-ats.c:228
long int base_rate
Definition: ats-testing.h:236
void GNUNET_ATS_TEST_generate_traffic_stop_all(void)
Stop all traffic generators.
An address for communicating with a peer.
struct GNUNET_TIME_Relative frequency
Automatic transport selection and outbound bandwidth determination.
Entry in list of pending tasks.
Definition: scheduler.c:131
int connected_ATS_service
Are we connected to ATS service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:360
int pref_val
ATS preference value.
Definition: ats-testing.h:418
static struct GNUNET_TIME_Relative duration
How long do we run the test?
static struct PendingResolutions * tail
Tail of list of pending resolution requests.
Definition: gnunet-ats.c:233
struct BenchmarkPeer * pref_partner
Masters only: Peer to set ATS preferences for.
Definition: ats-testing.h:170
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
int num_masters
Reference to perf_ats&#39; masters.
Header for all communications.
Time for absolute times used by GNUnet, in microseconds.
GNUNET_ATS_PreferenceKind
Enum defining all known preference categories.
struct TestbedConnectOperation * core_connect_ops
Masters only: Testbed connect operations to connect masters to slaves.
Definition: ats-testing.h:154
void(* GNUNET_ATS_TEST_TopologySetupDoneCallback)(void *cls, struct BenchmarkPeer *masters, struct BenchmarkPeer *slaves)
Callback to call when topology setup is completed.
Definition: ats-testing.h:83
int connected_COMM_service
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:365
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:274
A peer controlled by the testing framework.
long long unsigned int max_rate
Handle for the transport service (includes all of the state for the transport service).
void(* GNUNET_ATS_TESTING_ExperimentDoneCallback)(struct Experiment *e, struct GNUNET_TIME_Relative duration, int success)
Definition: ats-testing.h:475
GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb
Definition: ats-testing.h:455
static char * address
GNS address for this phone.
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:423
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:279
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:113
struct Experiment * GNUNET_ATS_TEST_experimentation_load(const char *filename)
Load an experiment from a file.
#define TEST_MESSAGE_SIZE
Size of test messages.
Definition: ats-testing.h:48
void GNUNET_ATS_TEST_generate_preferences_stop(struct PreferenceGenerator *pg)
Time for relative time used by GNUnet, in microseconds.