35 #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ 77 unsigned int b_sent_sec;
78 double kb_sent_percent;
79 unsigned int b_recv_sec;
80 double kb_recv_percent;
84 duration = (duration_total.
rel_value_us / (1000 * 1000));
92 "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n"),
106 kb_sent_percent = 0.0;
107 kb_recv_percent = 0.0;
124 "%c Master [%u] -> Slave [%u]: sent %u Bips (%.2f %%), received %u Bips (%.2f %%)\n",
127 b_sent_sec, kb_sent_percent,
128 b_recv_sec, kb_recv_percent);
130 "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n",
141 fprintf (stderr,
"Shutdown\n");
142 if (NULL != timeout_task)
200 "Experiment done successful in %s\n",
237 "Topology setup complete!\n");
284 &masters[c_m].partners[c_s],
291 &masters[c_m].partners[c_s],
300 &masters[c_m].partners[c_s],
309 &masters[c_m].partners[c_s],
338 for (c = 0; c < argc; c++)
340 if ((c < (argc - 1)) && (0 == strcmp (argv[c],
"-e")))
345 if (0 == strcmp (argv[c],
"-l"))
349 if (0 == strcmp (argv[c],
"-p"))
353 if (0 == strcmp (argv[c],
"-v"))
369 fprintf (stderr,
"No experiment given...\n");
373 fprintf (stderr,
"Loading experiment `%s' \n",
opt_exp_file);
377 fprintf (stderr,
"Invalid experiment\n");
382 fprintf (stderr,
"No episodes included\n");
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
unsigned int messages_sent
Number of messages sent to this partner.
unsigned int total_bytes_received
Total number of bytes this peer has received.
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.
uint64_t rel_value_us
The actual value.
struct Experiment * GNUNET_ATS_TEST_experimentation_load(const char *filename)
Load an experiment from a file.
static void do_shutdown(void *cls)
unsigned long long int num_masters
void GNUNET_ATS_TEST_logging_write_to_file(struct LoggingHandle *l, const char *experiment_name, int plots)
Write logging data to file.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received, or when GNUNET_SCHEDULER_shutdown() is being invoked.
#define GNUNET_TIME_UNIT_MINUTES
One minute.
static char * opt_exp_file
cmd option -e: experiment file
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
static void do_timeout(void *cls)
static void evaluate(struct GNUNET_TIME_Relative duration_total)
unsigned int bytes_received
Number of bytes received from this partner.
int main(int argc, char *argv[])
static int opt_verbose
cmd option -v: verbose logs
unsigned int num_episodes
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
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...
ATS performance characteristics for an address.
struct GNUNET_TIME_Relative log_freq
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.
static int opt_plot
cmd option -p: enable plots
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
static struct GNUNET_OS_Process * p
Helper process we started.
unsigned int total_app_rtt
Accumulated RTT for all messages.
void GNUNET_ATS_TEST_logging_stop(struct LoggingHandle *l)
Stop logging.
uint32_t bandwidth_in
Bandwidth assigned inbound.
Information we track for a peer in the testbed.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
void GNUNET_ATS_TEST_logging_clean_up(struct LoggingHandle *l)
Clean up logging data.
unsigned long long int num_slaves
Information about a benchmarking partner.
static void parse_args(int argc, char *argv[])
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
uint32_t bandwidth_out
Bandwidth assigned outbound.
ats testing library: setup topology and provide logging to test ats
static struct GNUNET_ATS_PerformanceHandle * ats
Handle to the ATS performance subsystem.
static struct BenchmarkPeer * slaves_p
void GNUNET_ATS_TEST_shutdown_topology(void)
Shutdown topology.
32-bit bandwidth used for network exchange by GNUnet, in bytes per second.
void GNUNET_ATS_TEST_experimentation_stop(struct Experiment *e)
Stop an experiment.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, struct GNUNET_TIME_Relative a2)
Add relative times together.
void GNUNET_ATS_TEST_generate_preferences_stop_all()
Stop all preferences generators.
unsigned int bytes_sent
Number of bytes sent to this partner.
static struct LoggingHandle * l
An address for communicating with a peer.
Automatic transport selection and outbound bandwidth determination.
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
static struct GNUNET_TIME_Relative duration
How long do we run the test?
struct BenchmarkPeer * pref_partner
Masters only: Peer to set ATS preferences for.
static struct BenchmarkPeer * masters_p
static struct GNUNET_SCHEDULER_Task * timeout_task
void GNUNET_ATS_TEST_generate_traffic_stop_all()
Stop all traffic generators.
static void topology_setup_done(void *cls, struct BenchmarkPeer *masters, struct BenchmarkPeer *slaves)
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_AddressInformationCallback log_request_cb)
Create a topology for ats testing.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
struct GNUNET_TIME_Relative max_duration
static struct Experiment * e
static char * address
GNS address for this phone.
static int opt_log
cmd option -l: enable logging
struct BenchmarkPeer * dest
The partner peer.
static void episode_done_cb(struct Episode *ep)
#define GNUNET_free(ptr)
Wrapper around free.
static void log_request__cb(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 *ats)
Time for relative time used by GNUnet, in microseconds.
static void experiment_done_cb(struct Experiment *e, struct GNUNET_TIME_Relative duration, int success)
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.