aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ats/perf_ats.c98
-rw-r--r--src/ats/perf_ats_simplistic_bandwidth.conf18
2 files changed, 86 insertions, 30 deletions
diff --git a/src/ats/perf_ats.c b/src/ats/perf_ats.c
index 8081f6240..726b78662 100644
--- a/src/ats/perf_ats.c
+++ b/src/ats/perf_ats.c
@@ -30,7 +30,7 @@
30#include "gnunet_core_service.h" 30#include "gnunet_core_service.h"
31 31
32#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) 32#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
33#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) 33#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
34#define TESTNAME_PREFIX "perf_ats_" 34#define TESTNAME_PREFIX "perf_ats_"
35#define DEFAULT_SLAVES_NUM 3 35#define DEFAULT_SLAVES_NUM 3
36#define DEFAULT_MASTERS_NUM 1 36#define DEFAULT_MASTERS_NUM 1
@@ -126,6 +126,11 @@ struct BenchmarkPeer
126 uint32_t send_mask; 126 uint32_t send_mask;
127 127
128 /** 128 /**
129 * Current message for partner?
130 */
131 int partner_msg;
132
133 /**
129 * Number of core connections 134 * Number of core connections
130 */ 135 */
131 int core_connections; 136 int core_connections;
@@ -139,6 +144,7 @@ struct BenchmarkPeer
139 * Statistics 144 * Statistics
140 */ 145 */
141 unsigned int messages_sent; 146 unsigned int messages_sent;
147 unsigned int messages_sent_partner;
142 unsigned int messages_received; 148 unsigned int messages_received;
143}; 149};
144 150
@@ -230,11 +236,19 @@ core_connect_completion_cb (void *cls,
230static void evaluate () 236static void evaluate ()
231{ 237{
232 int c_p; 238 int c_p;
239 struct BenchmarkPeer *bp;
240 int total_out;
241 int partner_out;
242
233 for (c_p = 0; c_p < c_master_peers; c_p++) 243 for (c_p = 0; c_p < c_master_peers; c_p++)
234 { 244 {
235 GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Peer %u: %u KiB/s \n"), 245 bp = &bp_master[c_p];
236 bp_master[c_p].no, 246 total_out = (bp->messages_sent * TEST_MESSAGE_SIZE) / 10240;
237 (bp_master[c_p].messages_sent * TEST_MESSAGE_SIZE) / 10240); 247 partner_out = (bp->messages_sent_partner * TEST_MESSAGE_SIZE) / 10240;
248 fprintf (stderr, _("Peer %u: Out total: %u KiB/s, out partner %u KiB/s\n"),
249 bp->no,
250 total_out, partner_out
251 /*partner_out / (total_out / 100)*/);
238 } 252 }
239} 253}
240 254
@@ -392,10 +406,6 @@ store_information (struct GNUNET_PeerIdentity *id,
392 GNUNET_break (0); 406 GNUNET_break (0);
393 return; 407 return;
394 } 408 }
395
396
397
398
399} 409}
400 410
401static void 411static void
@@ -407,22 +417,32 @@ ats_performance_info_cb (void *cls,
407 const struct GNUNET_ATS_Information *ats, 417 const struct GNUNET_ATS_Information *ats,
408 uint32_t ats_count) 418 uint32_t ats_count)
409{ 419{
410 struct BenchmarkPeer *p = cls; 420 struct BenchmarkPeer *bp = cls;
411 int c_a; 421 int c_a;
412 char *peer_id; 422 char *peer_id;
413 423
414 peer_id = GNUNET_strdup (GNUNET_i2s (&p->id)); 424 peer_id = GNUNET_strdup (GNUNET_i2s (&bp->id));
415 for (c_a = 0; c_a < ats_count; c_a++) 425 for (c_a = 0; c_a < ats_count; c_a++)
416 { 426 {
417 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("%c %03u: %s %s %u\n"), 427 /*GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("%c %03u: %s %s %u\n"),
418 (GNUNET_YES == p->master) ? 'M' : 'S', 428 (GNUNET_YES == p->master) ? 'M' : 'S',
419 p->no, 429 p->no,
420 GNUNET_i2s (&address->peer), 430 GNUNET_i2s (&address->peer),
421 GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)), 431 GNUNET_ATS_print_property_type(ntohl(ats[c_a].type)),
422 ntohl(ats[c_a].value)); 432 ntohl(ats[c_a].value));*/
423 } 433 }
424 434
425 store_information (&p->id, address, address_active, 435 if ((GNUNET_YES == bp->master) &&
436 (0 == memcmp (&address->peer, &bp->destination->id,
437 sizeof (struct GNUNET_PeerIdentity))))
438 {
439 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Bandwidth for master %u: %lu %lu\n",
440 bp->no,
441 (long unsigned int) ntohl(bandwidth_in.value__),
442 (long unsigned int) ntohl(bandwidth_in.value__));
443 }
444
445 store_information (&bp->id, address, address_active,
426 bandwidth_in, bandwidth_out, 446 bandwidth_in, bandwidth_out,
427 ats, ats_count); 447 ats, ats_count);
428 448
@@ -437,7 +457,13 @@ core_send_ready (void *cls, size_t size, void *buf)
437 struct GNUNET_MessageHeader *msg; 457 struct GNUNET_MessageHeader *msg;
438 458
439 bp->cth = NULL; 459 bp->cth = NULL;
460
440 bp->messages_sent ++; 461 bp->messages_sent ++;
462 if (GNUNET_YES == bp->partner_msg)
463 {
464 bp->messages_sent_partner ++;
465 bp->partner_msg = GNUNET_NO;
466 }
441 467
442 msg = (struct GNUNET_MessageHeader *) &msgbuf; 468 msg = (struct GNUNET_MessageHeader *) &msgbuf;
443 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE); 469 memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
@@ -485,12 +511,17 @@ get_next (struct BenchmarkPeer *p)
485static void 511static void
486ats_pref_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 512ats_pref_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
487{ 513{
514 static double last = 1;
488 struct BenchmarkPeer *bp = cls; 515 struct BenchmarkPeer *bp = cls;
489 516
490 bp->ats_task = GNUNET_SCHEDULER_NO_TASK; 517 bp->ats_task = GNUNET_SCHEDULER_NO_TASK;
491 518
492 GNUNET_break (0); 519 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Set preference for master %u: %f\n",
493 520 bp->no, last);
521 GNUNET_ATS_change_preference (bp->p_handle, &bp->destination->id,
522 GNUNET_ATS_PREFERENCE_BANDWIDTH, (double) last,
523 GNUNET_ATS_PREFERENCE_END);
524 last++;
494 bp->ats_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 525 bp->ats_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
495 &ats_pref_task, bp); 526 &ats_pref_task, bp);
496} 527}
@@ -501,6 +532,7 @@ do_benchmark ()
501{ 532{
502 int c_m; 533 int c_m;
503 struct BenchmarkPeer *s; 534 struct BenchmarkPeer *s;
535 struct BenchmarkPeer *bp;
504 536
505 if ((state.connected_ATS_service == GNUNET_NO) || 537 if ((state.connected_ATS_service == GNUNET_NO) ||
506 (state.connected_CORE_service == GNUNET_NO) || 538 (state.connected_CORE_service == GNUNET_NO) ||
@@ -519,13 +551,16 @@ do_benchmark ()
519 /* Start sending test messages */ 551 /* Start sending test messages */
520 for (c_m = 0; c_m < c_master_peers; c_m ++) 552 for (c_m = 0; c_m < c_master_peers; c_m ++)
521 { 553 {
522 s = get_next (&bp_master[c_m]); 554 bp = &bp_master[c_m];
523 bp_master[c_m].cth = GNUNET_CORE_notify_transmit_ready (bp_master[c_m].ch, 555 s = get_next (bp);
556 if (0 == memcmp(&s->id, &bp->destination->id, sizeof (struct GNUNET_PeerIdentity)))
557 bp->partner_msg = GNUNET_YES;
558 bp->cth = GNUNET_CORE_notify_transmit_ready (bp->ch,
524 GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES, 559 GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES,
525 &s->id, 560 &s->id,
526 TEST_MESSAGE_SIZE, &core_send_ready, &bp_master[c_m]); 561 TEST_MESSAGE_SIZE, &core_send_ready, bp);
527 bp_master[c_m].ats_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 562 bp->ats_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
528 &ats_pref_task, &bp_master[c_m]); 563 &ats_pref_task, bp);
529 } 564 }
530 565
531 566
@@ -574,6 +609,7 @@ do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
574{ 609{
575 int c_m; 610 int c_m;
576 int c_s; 611 int c_s;
612 struct BenchmarkPeer *bp;
577 613
578 if ((state.connected_ATS_service == GNUNET_NO) || 614 if ((state.connected_ATS_service == GNUNET_NO) ||
579 (state.connected_CORE_service == GNUNET_NO)) 615 (state.connected_CORE_service == GNUNET_NO))
@@ -585,26 +621,27 @@ do_connect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
585 621
586 for (c_m = 0; c_m < c_master_peers; c_m ++) 622 for (c_m = 0; c_m < c_master_peers; c_m ++)
587 { 623 {
588 bp_master[c_m].connect_ops = GNUNET_malloc (c_slave_peers * sizeof (struct ConnectOperation)); 624 bp = &bp_master[c_m];
625 bp->connect_ops = GNUNET_malloc (c_slave_peers * sizeof (struct ConnectOperation));
589 626
590 for (c_s = 0; c_s < c_slave_peers; c_s ++) 627 for (c_s = 0; c_s < c_slave_peers; c_s ++)
591 { 628 {
592 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting master peer %u with slave peer %u\n"), 629 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Connecting master peer %u with slave peer %u\n"),
593 bp_master[c_m].no, bp_slaves[c_s].no); 630 bp->no, bp_slaves[c_s].no);
594 631
595 bp_master[c_m].connect_ops[c_s].master = &bp_master[c_m]; 632 bp->connect_ops[c_s].master = bp;
596 bp_master[c_m].connect_ops[c_s].slave = &bp_slaves[c_s]; 633 bp->connect_ops[c_s].slave = &bp_slaves[c_s];
597 bp_master[c_m].connect_ops[c_s].connect_op = GNUNET_TESTBED_overlay_connect( NULL, 634 bp->connect_ops[c_s].connect_op = GNUNET_TESTBED_overlay_connect( NULL,
598 &connect_completion_callback, 635 &connect_completion_callback,
599 &bp_master[c_m].connect_ops[c_s], 636 &bp->connect_ops[c_s],
600 bp_slaves[c_s].peer, 637 bp_slaves[c_s].peer,
601 bp_master[c_m].peer); 638 bp->peer);
602 639
603 if (NULL == bp_master[c_m].connect_ops[c_s].connect_op) 640 if (NULL == bp->connect_ops[c_s].connect_op)
604 { 641 {
605 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 642 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
606 _("Could not connect master peer %u and slave peer %u\n"), 643 _("Could not connect master peer %u and slave peer %u\n"),
607 bp_master[c_m].no, bp_slaves[c_s].no); 644 bp->no, bp_slaves[c_s].no);
608 GNUNET_break (0); 645 GNUNET_break (0);
609 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task) 646 if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
610 GNUNET_SCHEDULER_cancel(shutdown_task); 647 GNUNET_SCHEDULER_cancel(shutdown_task);
@@ -849,6 +886,8 @@ core_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other,
849 } 886 }
850 me->messages_received ++; 887 me->messages_received ++;
851 next = get_next (me); 888 next = get_next (me);
889 if (0 == memcmp(&remote->id, &me->destination->id, sizeof (struct GNUNET_PeerIdentity)))
890 me->partner_msg = GNUNET_YES;
852 me->cth = GNUNET_CORE_notify_transmit_ready (me->ch, 891 me->cth = GNUNET_CORE_notify_transmit_ready (me->ch,
853 GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES, 892 GNUNET_NO, 0, GNUNET_TIME_UNIT_MINUTES,
854 &next->id, 893 &next->id,
@@ -1138,7 +1177,6 @@ test_main (void *cls, unsigned int num_peers,
1138 unsigned int links_failed) 1177 unsigned int links_failed)
1139{ 1178{
1140 int c_p; 1179 int c_p;
1141 uint32_t partner_map;
1142 1180
1143 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1181 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1144 _("Benchmarking solver `%s' on preference `%s' with %u master and %u slave peers\n"), 1182 _("Benchmarking solver `%s' on preference `%s' with %u master and %u slave peers\n"),
diff --git a/src/ats/perf_ats_simplistic_bandwidth.conf b/src/ats/perf_ats_simplistic_bandwidth.conf
index 4d13e5444..95a0b5894 100644
--- a/src/ats/perf_ats_simplistic_bandwidth.conf
+++ b/src/ats/perf_ats_simplistic_bandwidth.conf
@@ -7,3 +7,21 @@ BROADCAST = NO
7[peerinfo] 7[peerinfo]
8USE_INCLUDED_HELLOS = NO 8USE_INCLUDED_HELLOS = NO
9 9
10# Network specific inbound/outbound quotas
11UNSPECIFIED_QUOTA_IN = 128 KiB
12UNSPECIFIED_QUOTA_OUT = 128 KiB
13# LOOPBACK
14LOOPBACK_QUOTA_IN = 128 KiB
15LOOPBACK_QUOTA_OUT = 128 KiB
16# LAN
17LAN_QUOTA_IN = 128 KiB
18LAN_QUOTA_OUT = 128 KiB
19# WAN
20WAN_QUOTA_IN = 128 KiB
21WAN_QUOTA_OUT = 128 KiB
22# WLAN
23WLAN_QUOTA_IN = 128 KiB
24WLAN_QUOTA_OUT = 128 KiB
25# BLUETOOTH
26BLUETOOTH_QUOTA_IN = 128 KiB
27BLUETOOTH_QUOTA_OUT = 128 KiB \ No newline at end of file