From b56915c0dac905b845f0ad81fe77337c768a0e0f Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Thu, 9 Apr 2015 10:08:55 +0000 Subject: removing GNUNET_ATS_Information from ats-testing and logging uses GNUNET_ATS_Properties instead --- src/ats-tests/ats-testing-log.c | 42 +++++++++---------------- src/ats-tests/ats-testing.c | 69 +++++++++++++---------------------------- src/ats-tests/ats-testing.h | 30 +++++++++--------- 3 files changed, 51 insertions(+), 90 deletions(-) (limited to 'src/ats-tests') diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c index c3aba3f08..feba0ac51 100644 --- a/src/ats-tests/ats-testing-log.c +++ b/src/ats-tests/ats-testing-log.c @@ -121,25 +121,19 @@ struct PartnerLoggingTimestep /* Current ATS properties */ - uint32_t ats_distance; + unsigned int ats_distance; - uint32_t ats_delay; + struct GNUNET_TIME_Relative ats_delay; uint32_t bandwidth_in; uint32_t bandwidth_out; - uint32_t ats_utilization_up; + uint32_t ats_utilization_out; - uint32_t ats_utilization_down; + uint32_t ats_utilization_in; - uint32_t ats_network_type; - - uint32_t ats_cost_wan; - - uint32_t ats_cost_lan; - - uint32_t ats_cost_wlan; + enum GNUNET_ATS_Network_Type ats_network_type; double pref_bandwidth; double pref_delay; @@ -541,7 +535,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, /* Assembling slave string */ GNUNET_asprintf(&data, - "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n", + "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n", (long long unsigned int) cur_lt->timestamp.abs_value_us, (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start, cur_lt->timestamp).rel_value_us / 1000, @@ -554,20 +548,17 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, (double) plt->app_rtt / 1000, plt->bandwidth_in, plt->bandwidth_out, - plt->ats_cost_lan, - plt->ats_cost_wan, - plt->ats_cost_wlan, plt->ats_delay, plt->ats_distance, plt->ats_network_type, - plt->ats_utilization_up, - plt->ats_utilization_down, + plt->ats_utilization_out, + plt->ats_utilization_in, plt->pref_bandwidth, plt->pref_delay); if (l->verbose) fprintf (stderr, - "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n", + "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n", plt->slave->no, plt->total_messages_sent, plt->total_bytes_sent, @@ -576,7 +567,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, plt->total_bytes_received, plt->throughput_recv, plt->app_rtt, - plt->ats_delay, + (long long unsigned int) plt->ats_delay.rel_value_us, plt->bandwidth_in, plt->bandwidth_out); @@ -737,14 +728,11 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l) slt->total_messages_received = p->messages_received; slt->total_app_rtt = p->total_app_rtt; /* ats performance information */ - slt->ats_cost_lan = p->ats_cost_lan; - slt->ats_cost_wan = p->ats_cost_wan; - slt->ats_cost_wlan = p->ats_cost_wlan; - slt->ats_delay = p->ats_delay; - slt->ats_distance = p->ats_distance; - slt->ats_network_type = p->ats_network_type; - slt->ats_utilization_down = p->ats_utilization_down; - slt->ats_utilization_up = p->ats_utilization_up; + slt->ats_delay = p->props.delay; + slt->ats_distance = p->props.distance; + slt->ats_network_type = p->props.scope; + slt->ats_utilization_in = p->props.utilization_out; + slt->ats_utilization_out = p->props.utilization_out; slt->bandwidth_in = p->bandwidth_in; slt->bandwidth_out = p->bandwidth_out; slt->pref_bandwidth = p->pref_bandwidth; diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index a566a242c..bed1b87dd 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c @@ -548,8 +548,7 @@ ats_performance_info_cb (void *cls, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count) + const struct GNUNET_ATS_Properties *ats_prop) { struct BenchmarkPeer *me = cls; struct BenchmarkPartner *p; @@ -574,55 +573,23 @@ ats_performance_info_cb (void *cls, p->bandwidth_in = ntohl (bandwidth_in.value__); p->bandwidth_out = ntohl (bandwidth_out.value__); - for (c_a = 0; c_a < ats_count; c_a++) - { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s %s %u\n", - (GNUNET_YES == p->me->master) ? "Master" : "Slave", - p->me->no, - GNUNET_i2s (&p->dest->id), - GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)), - ntohl(ats[c_a].value)); - switch (ntohl (ats[c_a].type )) - { - case GNUNET_ATS_ARRAY_TERMINATOR: - break; - case GNUNET_ATS_UTILIZATION_OUT: - if (p->ats_utilization_up != ntohl (ats[c_a].value)) - log = GNUNET_YES; - p->ats_utilization_up = ntohl (ats[c_a].value); - - break; - case GNUNET_ATS_UTILIZATION_IN: - if (p->ats_utilization_down != ntohl (ats[c_a].value)) - log = GNUNET_YES; - p->ats_utilization_down = ntohl (ats[c_a].value); - break; - case GNUNET_ATS_NETWORK_TYPE: - if (p->ats_network_type != ntohl (ats[c_a].value)) - log = GNUNET_YES; - p->ats_network_type = ntohl (ats[c_a].value); - break; - case GNUNET_ATS_QUALITY_NET_DELAY: - if (p->ats_delay != ntohl (ats[c_a].value)) - log = GNUNET_YES; - p->ats_delay = ntohl (ats[c_a].value); - break; - case GNUNET_ATS_QUALITY_NET_DISTANCE: - if (p->ats_distance != ntohl (ats[c_a].value)) - log = GNUNET_YES; - p->ats_distance = ntohl (ats[c_a].value); - GNUNET_break (0); - break; - default: - break; - } - } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s\n", + (GNUNET_YES == p->me->master) ? "Master" : "Slave", + p->me->no, + GNUNET_i2s (&p->dest->id)); + + p->props.utilization_out = ats_prop->utilization_out; + p->props.utilization_in = ats_prop->utilization_in; + p->props.scope = ats_prop->scope; + p->props.delay = ats_prop->delay; + p->props.distance = ats_prop->distance; + if (GNUNET_YES == log) top->ats_perf_cb (cls, address, address_active, bandwidth_out, bandwidth_in, - ats, ats_count); + ats_prop); GNUNET_free(peer_id); } @@ -634,8 +601,7 @@ ats_perf_connect_adapter (void *cls, struct BenchmarkPeer *me = cls; me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, - &ats_performance_info_cb, - me); + &ats_performance_info_cb, me); if (NULL == me->ats_perf_handle) GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create ATS performance handle \n"); @@ -797,6 +763,13 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, { top->sps[c_s].partners[c_m].me = &top->sps[c_s]; top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; + + /* Initialize properties */ + top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO; + top->sps[c_s].partners[c_m].props.distance = 0; + top->sps[c_s].partners[c_m].props.scope = GNUNET_ATS_NET_UNSPECIFIED; + top->sps[c_s].partners[c_m].props.utilization_in = 0; + top->sps[c_s].partners[c_m].props.utilization_out = 0; } /* Get configuration */ top->sps[c_s].peer_id_op = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer, diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index a2e61c0d6..42b6b9eb3 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h @@ -283,7 +283,15 @@ struct BenchmarkPartner */ struct GNUNET_TRANSPORT_TransmitHandle *tth; + + /** + * Handle for traffic generator + */ struct TrafficGenerator *tg; + + /** + * Handle for preference generator + */ struct PreferenceGenerator *pg; /** @@ -317,29 +325,21 @@ struct BenchmarkPartner unsigned int bytes_received; /* Current ATS properties */ + struct GNUNET_ATS_Properties props; - uint32_t ats_distance; - - uint32_t ats_delay; - + /* Bandwidth assigned inbound */ uint32_t bandwidth_in; + /* Bandwidth assigned outbound */ uint32_t bandwidth_out; - uint32_t ats_utilization_up; - - uint32_t ats_utilization_down; - - uint32_t ats_network_type; - - uint32_t ats_cost_wan; + /* Current preference values for bandwidth */ + double pref_bandwidth; - uint32_t ats_cost_lan; + /* Current preference values for delay */ + double pref_delay; - uint32_t ats_cost_wlan; - double pref_bandwidth; - double pref_delay; }; /** -- cgit v1.2.3