GNUnet  0.11.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 
52 {
54 
55  uint8_t padding[TEST_MESSAGE_SIZE - sizeof(struct GNUNET_MessageHeader)];
56 };
57 
58 
59 struct BenchmarkPartner;
60 
61 struct BenchmarkPeer;
62 
64 
65 struct TrafficGenerator;
66 
67 struct LoggingHandle;
68 
70 {
75 };
76 
77 
86  void *cls,
87  struct BenchmarkPeer *masters,
88  struct BenchmarkPeer *slaves);
89 
100 typedef void (*GNUNET_ATS_TEST_LogRequest) (
101  void *cls,
102  const struct GNUNET_HELLO_Address *address,
103  int address_active,
104  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
105  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
106  const struct GNUNET_ATS_Properties *prop);
107 
112 {
117 
121  int no;
122 
126  int master;
127 
132 
137 
142 
147 
152 
158 
163 
168 
174 
180 
185  double pref_value;
186 
192 
197 
202 
208 
212  unsigned int total_messages_sent;
213 
217  unsigned int total_bytes_sent;
218 
223 
227  unsigned int total_bytes_received;
228 };
229 
231 {
234 
236 
239 
240  long int base_rate;
241  long int max_rate;
242  struct GNUNET_TIME_Relative duration_period;
243 
245  struct GNUNET_TIME_Absolute next_ping_transmission;
246  struct GNUNET_TIME_Absolute time_start;
247 };
248 
249 
250 struct PreferenceGenerator
251 {
252  struct PreferenceGenerator *prev;
253  struct PreferenceGenerator *next;
254 
255  enum GeneratorType type;
256 
259 
260  enum GNUNET_ATS_PreferenceKind kind;
261 
262  long int base_value;
263  long int max_value;
264  struct GNUNET_TIME_Relative duration_period;
265  struct GNUNET_TIME_Relative frequency;
266 
267  struct GNUNET_SCHEDULER_Task *set_task;
268  struct GNUNET_TIME_Absolute next_ping_transmission;
269  struct GNUNET_TIME_Absolute time_start;
270 };
271 
276 {
280  struct BenchmarkPeer *me;
281 
286 
291 
296 
301 
305  struct GNUNET_TIME_Absolute last_message_sent;
306 
310  unsigned int total_app_rtt;
311 
315  unsigned int messages_sent;
316 
320  unsigned int bytes_sent;
321 
325  unsigned int messages_received;
326 
330  unsigned int bytes_received;
331 
336 
340  uint32_t bandwidth_in;
341 
345  uint32_t bandwidth_out;
346 
351 
355  double pref_delay;
356 };
357 
358 
363 {
368 
373 
378 
383 
388 };
389 
390 
392 {
397 
401  int result;
402 
407 
411  char *solver;
412 
416  char *testname;
417 
421  char *pref_str;
422 
426  int pref_val;
427 
431  unsigned int num_masters;
432 
437 
441  unsigned int num_slaves;
442 
447 
451  struct GNUNET_TIME_Relative perf_duration;
452 
456  struct GNUNET_TIME_Relative log_frequency;
457 
462 
464 
466 
467  void *done_cb_cls;
468 };
469 
471 {
476 };
477 
478 struct Episode;
479 
480 struct Experiment;
481 
483 
485  struct Experiment *e,
487  int success);
488 
493 {
496 
497  long long unsigned int src_id;
498  long long unsigned int dest_id;
499 
500  long long unsigned int base_rate;
501  long long unsigned int max_rate;
502  struct GNUNET_TIME_Relative period;
503  struct GNUNET_TIME_Relative frequency;
504 
505  enum OperationType type;
506  enum GeneratorType gen_type;
507  enum GNUNET_ATS_PreferenceKind pref_type;
508 };
509 
510 struct Episode
511 {
512  int id;
513  struct Episode *next;
515 
518 };
519 
520 
521 struct Experiment
522 {
523  char *name;
524  char *cfg_file;
525  unsigned long long int num_masters;
526  unsigned long long int num_slaves;
527  struct GNUNET_TIME_Relative log_freq;
528  struct GNUNET_TIME_Relative max_duration;
529  struct GNUNET_TIME_Relative total_duration;
531  unsigned int num_episodes;
532  struct Episode *start;
533 
534  struct GNUNET_SCHEDULER_Task *experiment_timeout_task;
535  struct GNUNET_SCHEDULER_Task *episode_timeout_task;
536  struct Episode *cur;
537 
540 };
541 
542 
543 extern struct GNUNET_CONFIGURATION_Handle *cfg;
544 
552 void
554  struct Experiment *e,
557 
558 
565 struct Experiment *
567 
568 
574 void
576 
577 
578 void
580 
581 
582 void
584 
585 
599 struct TrafficGenerator *
601  struct BenchmarkPartner *dest,
602  enum GeneratorType type,
603  unsigned int base_rate,
604  unsigned int max_rate,
605  struct GNUNET_TIME_Relative period,
607 
608 
609 void
611 
612 
616 void
618 
619 
634 struct PreferenceGenerator *
636  struct BenchmarkPeer *src,
637  struct BenchmarkPartner *dest,
638  enum GeneratorType type,
639  unsigned int base_value,
640  unsigned int value_rate,
641  struct GNUNET_TIME_Relative period,
644 
645 
646 void
648 
649 
650 void
652 
653 
665 struct LoggingHandle *
667  const char *testname,
668  struct BenchmarkPeer *masters,
669  int num_masters,
670  int num_slaves,
671  int verbose);
672 
673 
679 void
681 
682 
688 void
690 
691 
697 void
699 
700 
708 void
710  const char *test_name,
711  int plots);
712 
713 
717 struct BenchmarkPeer *
718 GNUNET_ATS_TEST_get_peer (int src);
719 
720 
721 struct BenchmarkPartner *
722 GNUNET_ATS_TEST_get_partner (int src, int dest);
723 
724 
738 void
740  char *name,
741  char *cfg_file,
742  unsigned int num_slaves,
743  unsigned int num_masters,
744  int test_core,
746  void *done_cb_cls,
748 
749 
753 void
755 
756 
757 /* end of file ats-testing.h */
char * solver
Solver string.
Definition: ats-testing.h:411
struct GNUNET_ATS_TEST_Operation * next
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
Definition: ats-testing.h:217
unsigned int messages_sent
Number of messages sent to this partner.
Definition: ats-testing.h:315
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:227
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:406
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:146
int connected_CORE
Are we connected to all slave peers on CORE level: GNUNET_YES/NO.
Definition: ats-testing.h:382
struct GNUNET_TESTBED_Operation * peer_id_op
Testbed operation to get peer information.
Definition: ats-testing.h:136
Connect peers with testbed.
Definition: ats-testing.c:33
struct Episode * next
struct TrafficGenerator * next
Definition: ats-testing.h:233
struct GNUNET_CONFIGURATION_Handle * cfg
Handle to our configuration.
Definition: ats-testing.c:51
Context for the core service connection.
Definition: core_api.c:77
unsigned long long int num_masters
Definition: ats-testing.h:525
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:141
void GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p)
char * testname
Preference string.
Definition: ats-testing.h:416
struct TrafficGenerator * prev
Definition: ats-testing.h:232
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:482
struct BenchmarkPeer * GNUNET_ATS_TEST_get_peer(int src)
Topology related functions.
Definition: ats-testing.c:894
long int max_rate
Definition: ats-testing.h:241
struct GNUNET_CORE_Handle * ch
Core handle.
Definition: ats-testing.h:162
double pref_bandwidth
Current preference values for bandwidth.
Definition: ats-testing.h:350
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
struct PreferenceGenerator * pg
Handle for preference generator.
Definition: ats-testing.h:300
Overall state of the performance benchmark.
Definition: ats-testing.h:362
struct GNUNET_TRANSPORT_CoreHandle * th
Transport handle.
Definition: ats-testing.h:167
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:222
long long unsigned int src_id
Definition: ats-testing.h:497
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:330
static struct Experiment * e
uint8_t padding[100 - sizeof(struct GNUNET_MessageHeader)]
Definition: ats-testing.h:55
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:244
void GNUNET_ATS_TEST_logging_now(struct LoggingHandle *l)
Log all data now.
int core_connections
Number of core connections.
Definition: ats-testing.h:201
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:903
ATS performance characteristics for an address.
struct BenchmarkPartner * dest
Definition: ats-testing.h:238
struct GNUNET_SCHEDULER_Task * progress_task
Progress task.
Definition: ats-testing.h:396
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:212
double pref_value
Masters only Progress task.
Definition: ats-testing.h:185
enum GNUNET_ATS_PreferenceKind kind
struct BenchmarkPartner * dest
Definition: ats-testing.h:258
static struct LoggingHandle * l
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
struct GNUNET_MessageHeader header
Definition: ats-testing.h:53
int num_partners
Number of partners.
Definition: ats-testing.h:196
enum State state
current state of profiling
int no
Unique identifier.
Definition: ats-testing.h:121
int benchmarking
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:387
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:310
void GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg)
static int verbose
uint32_t bandwidth_in
Bandwidth assigned inbound.
Definition: ats-testing.h:340
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:927
Information we track for a peer in the testbed.
Definition: ats-testing.h:111
double pref_delay
Current preference values for delay.
Definition: ats-testing.h:355
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:126
long long unsigned int dest_id
Definition: ats-testing.h:498
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:100
long long unsigned int base_rate
unsigned long long int num_slaves
Definition: ats-testing.h:526
static char * filename
Information about a benchmarking partner.
Definition: ats-testing.h:275
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:325
struct GNUNET_ATS_PerformanceHandle * ats_perf_handle
ATS performance handle.
Definition: ats-testing.h:151
uint32_t bandwidth_out
Bandwidth assigned outbound.
Definition: ats-testing.h:345
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:580
void GNUNET_ATS_TEST_shutdown_topology(void)
Shutdown topology.
Definition: ats-testing.c:967
int result
Test result.
Definition: ats-testing.h:401
static const char * cfg_file
Configuration filename.
int core_slave_connections
Masters only: Number of connections to slave peers.
Definition: ats-testing.h:207
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:421
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:441
struct BenchmarkPeer * src
Definition: ats-testing.h:257
struct BenchmarkPeer * src
Definition: ats-testing.h:237
int connected_PEERS
Are we connected to all peers: GNUNET_YES/NO.
Definition: ats-testing.h:377
struct GNUNET_ATS_TEST_Operation * prev
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:446
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:436
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
GNUNET_ATS_AddressInformationCallback ats_perf_cb
Definition: ats-testing.h:465
ATS Handle to obtain and/or modify performance information.
Handle to a message queue.
Definition: mq.c:85
struct GNUNET_SCHEDULER_Task * ats_task
Masters only Progress task.
Definition: ats-testing.h:179
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:320
struct GNUNET_MQ_Handle * mq
Message queue handle.
Definition: ats-testing.h:290
configuration data
Definition: configuration.c:85
static struct PendingResolutions * head
Head of list of pending resolution requests.
Definition: gnunet-ats.c:230
const char * name
long int base_rate
Definition: ats-testing.h:240
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:134
int connected_ATS_service
Are we connected to ATS service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:367
int pref_val
ATS preference value.
Definition: ats-testing.h:426
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:235
struct BenchmarkPeer * pref_partner
Masters only: Peer to set ATS preferences for.
Definition: ats-testing.h:173
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:157
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:85
int connected_COMM_service
Are we connected to CORE service of all peers: GNUNET_YES/NO.
Definition: ats-testing.h:372
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
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:484
GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb
Definition: ats-testing.h:463
static char * address
GNS address for this phone.
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:431
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
struct GNUNET_TESTBED_Peer * peer
Handle with testbed.
Definition: ats-testing.h:116
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.