diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2015-04-09 10:08:55 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2015-04-09 10:08:55 +0000 |
commit | b56915c0dac905b845f0ad81fe77337c768a0e0f (patch) | |
tree | 5a08d8526982939f3f9b129fc3c2b71a8ba2e331 /src/ats-tests | |
parent | f9793c90915916e1c6f190ca817b1da3c8945120 (diff) | |
download | gnunet-b56915c0dac905b845f0ad81fe77337c768a0e0f.tar.gz gnunet-b56915c0dac905b845f0ad81fe77337c768a0e0f.zip |
removing GNUNET_ATS_Information from ats-testing and logging
uses GNUNET_ATS_Properties instead
Diffstat (limited to 'src/ats-tests')
-rw-r--r-- | src/ats-tests/ats-testing-log.c | 42 | ||||
-rw-r--r-- | src/ats-tests/ats-testing.c | 69 | ||||
-rw-r--r-- | src/ats-tests/ats-testing.h | 30 |
3 files changed, 51 insertions, 90 deletions
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 | |||
121 | 121 | ||
122 | /* Current ATS properties */ | 122 | /* Current ATS properties */ |
123 | 123 | ||
124 | uint32_t ats_distance; | 124 | unsigned int ats_distance; |
125 | 125 | ||
126 | uint32_t ats_delay; | 126 | struct GNUNET_TIME_Relative ats_delay; |
127 | 127 | ||
128 | uint32_t bandwidth_in; | 128 | uint32_t bandwidth_in; |
129 | 129 | ||
130 | uint32_t bandwidth_out; | 130 | uint32_t bandwidth_out; |
131 | 131 | ||
132 | uint32_t ats_utilization_up; | 132 | uint32_t ats_utilization_out; |
133 | 133 | ||
134 | uint32_t ats_utilization_down; | 134 | uint32_t ats_utilization_in; |
135 | 135 | ||
136 | uint32_t ats_network_type; | 136 | enum GNUNET_ATS_Network_Type ats_network_type; |
137 | |||
138 | uint32_t ats_cost_wan; | ||
139 | |||
140 | uint32_t ats_cost_lan; | ||
141 | |||
142 | uint32_t ats_cost_wlan; | ||
143 | 137 | ||
144 | double pref_bandwidth; | 138 | double pref_bandwidth; |
145 | double pref_delay; | 139 | double pref_delay; |
@@ -541,7 +535,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, | |||
541 | 535 | ||
542 | /* Assembling slave string */ | 536 | /* Assembling slave string */ |
543 | GNUNET_asprintf(&data, | 537 | GNUNET_asprintf(&data, |
544 | "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n", | 538 | "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n", |
545 | (long long unsigned int) cur_lt->timestamp.abs_value_us, | 539 | (long long unsigned int) cur_lt->timestamp.abs_value_us, |
546 | (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start, | 540 | (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start, |
547 | cur_lt->timestamp).rel_value_us / 1000, | 541 | cur_lt->timestamp).rel_value_us / 1000, |
@@ -554,20 +548,17 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, | |||
554 | (double) plt->app_rtt / 1000, | 548 | (double) plt->app_rtt / 1000, |
555 | plt->bandwidth_in, | 549 | plt->bandwidth_in, |
556 | plt->bandwidth_out, | 550 | plt->bandwidth_out, |
557 | plt->ats_cost_lan, | ||
558 | plt->ats_cost_wan, | ||
559 | plt->ats_cost_wlan, | ||
560 | plt->ats_delay, | 551 | plt->ats_delay, |
561 | plt->ats_distance, | 552 | plt->ats_distance, |
562 | plt->ats_network_type, | 553 | plt->ats_network_type, |
563 | plt->ats_utilization_up, | 554 | plt->ats_utilization_out, |
564 | plt->ats_utilization_down, | 555 | plt->ats_utilization_in, |
565 | plt->pref_bandwidth, | 556 | plt->pref_bandwidth, |
566 | plt->pref_delay); | 557 | plt->pref_delay); |
567 | 558 | ||
568 | if (l->verbose) | 559 | if (l->verbose) |
569 | fprintf (stderr, | 560 | fprintf (stderr, |
570 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n", | 561 | "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n", |
571 | plt->slave->no, | 562 | plt->slave->no, |
572 | plt->total_messages_sent, | 563 | plt->total_messages_sent, |
573 | plt->total_bytes_sent, | 564 | plt->total_bytes_sent, |
@@ -576,7 +567,7 @@ GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, | |||
576 | plt->total_bytes_received, | 567 | plt->total_bytes_received, |
577 | plt->throughput_recv, | 568 | plt->throughput_recv, |
578 | plt->app_rtt, | 569 | plt->app_rtt, |
579 | plt->ats_delay, | 570 | (long long unsigned int) plt->ats_delay.rel_value_us, |
580 | plt->bandwidth_in, | 571 | plt->bandwidth_in, |
581 | plt->bandwidth_out); | 572 | plt->bandwidth_out); |
582 | 573 | ||
@@ -737,14 +728,11 @@ GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l) | |||
737 | slt->total_messages_received = p->messages_received; | 728 | slt->total_messages_received = p->messages_received; |
738 | slt->total_app_rtt = p->total_app_rtt; | 729 | slt->total_app_rtt = p->total_app_rtt; |
739 | /* ats performance information */ | 730 | /* ats performance information */ |
740 | slt->ats_cost_lan = p->ats_cost_lan; | 731 | slt->ats_delay = p->props.delay; |
741 | slt->ats_cost_wan = p->ats_cost_wan; | 732 | slt->ats_distance = p->props.distance; |
742 | slt->ats_cost_wlan = p->ats_cost_wlan; | 733 | slt->ats_network_type = p->props.scope; |
743 | slt->ats_delay = p->ats_delay; | 734 | slt->ats_utilization_in = p->props.utilization_out; |
744 | slt->ats_distance = p->ats_distance; | 735 | slt->ats_utilization_out = p->props.utilization_out; |
745 | slt->ats_network_type = p->ats_network_type; | ||
746 | slt->ats_utilization_down = p->ats_utilization_down; | ||
747 | slt->ats_utilization_up = p->ats_utilization_up; | ||
748 | slt->bandwidth_in = p->bandwidth_in; | 736 | slt->bandwidth_in = p->bandwidth_in; |
749 | slt->bandwidth_out = p->bandwidth_out; | 737 | slt->bandwidth_out = p->bandwidth_out; |
750 | slt->pref_bandwidth = p->pref_bandwidth; | 738 | 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, | |||
548 | int address_active, | 548 | int address_active, |
549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 549 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
550 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 550 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
551 | const struct GNUNET_ATS_Information *ats, | 551 | const struct GNUNET_ATS_Properties *ats_prop) |
552 | uint32_t ats_count) | ||
553 | { | 552 | { |
554 | struct BenchmarkPeer *me = cls; | 553 | struct BenchmarkPeer *me = cls; |
555 | struct BenchmarkPartner *p; | 554 | struct BenchmarkPartner *p; |
@@ -574,55 +573,23 @@ ats_performance_info_cb (void *cls, | |||
574 | p->bandwidth_in = ntohl (bandwidth_in.value__); | 573 | p->bandwidth_in = ntohl (bandwidth_in.value__); |
575 | p->bandwidth_out = ntohl (bandwidth_out.value__); | 574 | p->bandwidth_out = ntohl (bandwidth_out.value__); |
576 | 575 | ||
577 | for (c_a = 0; c_a < ats_count; c_a++) | 576 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s\n", |
578 | { | 577 | (GNUNET_YES == p->me->master) ? "Master" : "Slave", |
579 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s [%u] received ATS information: %s %s %u\n", | 578 | p->me->no, |
580 | (GNUNET_YES == p->me->master) ? "Master" : "Slave", | 579 | GNUNET_i2s (&p->dest->id)); |
581 | p->me->no, | 580 | |
582 | GNUNET_i2s (&p->dest->id), | 581 | p->props.utilization_out = ats_prop->utilization_out; |
583 | GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)), | 582 | p->props.utilization_in = ats_prop->utilization_in; |
584 | ntohl(ats[c_a].value)); | 583 | p->props.scope = ats_prop->scope; |
585 | switch (ntohl (ats[c_a].type )) | 584 | p->props.delay = ats_prop->delay; |
586 | { | 585 | p->props.distance = ats_prop->distance; |
587 | case GNUNET_ATS_ARRAY_TERMINATOR: | 586 | |
588 | break; | ||
589 | case GNUNET_ATS_UTILIZATION_OUT: | ||
590 | if (p->ats_utilization_up != ntohl (ats[c_a].value)) | ||
591 | log = GNUNET_YES; | ||
592 | p->ats_utilization_up = ntohl (ats[c_a].value); | ||
593 | |||
594 | break; | ||
595 | case GNUNET_ATS_UTILIZATION_IN: | ||
596 | if (p->ats_utilization_down != ntohl (ats[c_a].value)) | ||
597 | log = GNUNET_YES; | ||
598 | p->ats_utilization_down = ntohl (ats[c_a].value); | ||
599 | break; | ||
600 | case GNUNET_ATS_NETWORK_TYPE: | ||
601 | if (p->ats_network_type != ntohl (ats[c_a].value)) | ||
602 | log = GNUNET_YES; | ||
603 | p->ats_network_type = ntohl (ats[c_a].value); | ||
604 | break; | ||
605 | case GNUNET_ATS_QUALITY_NET_DELAY: | ||
606 | if (p->ats_delay != ntohl (ats[c_a].value)) | ||
607 | log = GNUNET_YES; | ||
608 | p->ats_delay = ntohl (ats[c_a].value); | ||
609 | break; | ||
610 | case GNUNET_ATS_QUALITY_NET_DISTANCE: | ||
611 | if (p->ats_distance != ntohl (ats[c_a].value)) | ||
612 | log = GNUNET_YES; | ||
613 | p->ats_distance = ntohl (ats[c_a].value); | ||
614 | GNUNET_break (0); | ||
615 | break; | ||
616 | default: | ||
617 | break; | ||
618 | } | ||
619 | } | ||
620 | if (GNUNET_YES == log) | 587 | if (GNUNET_YES == log) |
621 | top->ats_perf_cb (cls, address, | 588 | top->ats_perf_cb (cls, address, |
622 | address_active, | 589 | address_active, |
623 | bandwidth_out, | 590 | bandwidth_out, |
624 | bandwidth_in, | 591 | bandwidth_in, |
625 | ats, ats_count); | 592 | ats_prop); |
626 | GNUNET_free(peer_id); | 593 | GNUNET_free(peer_id); |
627 | } | 594 | } |
628 | 595 | ||
@@ -634,8 +601,7 @@ ats_perf_connect_adapter (void *cls, | |||
634 | struct BenchmarkPeer *me = cls; | 601 | struct BenchmarkPeer *me = cls; |
635 | 602 | ||
636 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, | 603 | me->ats_perf_handle = GNUNET_ATS_performance_init (cfg, |
637 | &ats_performance_info_cb, | 604 | &ats_performance_info_cb, me); |
638 | me); | ||
639 | if (NULL == me->ats_perf_handle) | 605 | if (NULL == me->ats_perf_handle) |
640 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 606 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
641 | "Failed to create ATS performance handle \n"); | 607 | "Failed to create ATS performance handle \n"); |
@@ -797,6 +763,13 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, | |||
797 | { | 763 | { |
798 | top->sps[c_s].partners[c_m].me = &top->sps[c_s]; | 764 | top->sps[c_s].partners[c_m].me = &top->sps[c_s]; |
799 | top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; | 765 | top->sps[c_s].partners[c_m].dest = &top->mps[c_m]; |
766 | |||
767 | /* Initialize properties */ | ||
768 | top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO; | ||
769 | top->sps[c_s].partners[c_m].props.distance = 0; | ||
770 | top->sps[c_s].partners[c_m].props.scope = GNUNET_ATS_NET_UNSPECIFIED; | ||
771 | top->sps[c_s].partners[c_m].props.utilization_in = 0; | ||
772 | top->sps[c_s].partners[c_m].props.utilization_out = 0; | ||
800 | } | 773 | } |
801 | /* Get configuration */ | 774 | /* Get configuration */ |
802 | top->sps[c_s].peer_id_op = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer, | 775 | 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 | |||
283 | */ | 283 | */ |
284 | struct GNUNET_TRANSPORT_TransmitHandle *tth; | 284 | struct GNUNET_TRANSPORT_TransmitHandle *tth; |
285 | 285 | ||
286 | |||
287 | /** | ||
288 | * Handle for traffic generator | ||
289 | */ | ||
286 | struct TrafficGenerator *tg; | 290 | struct TrafficGenerator *tg; |
291 | |||
292 | /** | ||
293 | * Handle for preference generator | ||
294 | */ | ||
287 | struct PreferenceGenerator *pg; | 295 | struct PreferenceGenerator *pg; |
288 | 296 | ||
289 | /** | 297 | /** |
@@ -317,29 +325,21 @@ struct BenchmarkPartner | |||
317 | unsigned int bytes_received; | 325 | unsigned int bytes_received; |
318 | 326 | ||
319 | /* Current ATS properties */ | 327 | /* Current ATS properties */ |
328 | struct GNUNET_ATS_Properties props; | ||
320 | 329 | ||
321 | uint32_t ats_distance; | 330 | /* Bandwidth assigned inbound */ |
322 | |||
323 | uint32_t ats_delay; | ||
324 | |||
325 | uint32_t bandwidth_in; | 331 | uint32_t bandwidth_in; |
326 | 332 | ||
333 | /* Bandwidth assigned outbound */ | ||
327 | uint32_t bandwidth_out; | 334 | uint32_t bandwidth_out; |
328 | 335 | ||
329 | uint32_t ats_utilization_up; | 336 | /* Current preference values for bandwidth */ |
330 | 337 | double pref_bandwidth; | |
331 | uint32_t ats_utilization_down; | ||
332 | |||
333 | uint32_t ats_network_type; | ||
334 | |||
335 | uint32_t ats_cost_wan; | ||
336 | 338 | ||
337 | uint32_t ats_cost_lan; | 339 | /* Current preference values for delay */ |
340 | double pref_delay; | ||
338 | 341 | ||
339 | uint32_t ats_cost_wlan; | ||
340 | 342 | ||
341 | double pref_bandwidth; | ||
342 | double pref_delay; | ||
343 | }; | 343 | }; |
344 | 344 | ||
345 | /** | 345 | /** |