diff options
author | Elias Summermatter <elias.summermatter@seccom.ch> | 2021-03-31 22:18:55 +0200 |
---|---|---|
committer | Elias Summermatter <elias.summermatter@seccom.ch> | 2021-03-31 22:18:55 +0200 |
commit | 2b242e3c756742cdd2ea867980f67d0f55f916f9 (patch) | |
tree | e5aca424ddf2cab3540d6dc836639c8535acb415 /src | |
parent | 7de314de496c4865fd57eab8601f75a0af24c8ce (diff) | |
download | gnunet-2b242e3c756742cdd2ea867980f67d0f55f916f9.tar.gz gnunet-2b242e3c756742cdd2ea867980f67d0f55f916f9.zip |
Added byte counter to setu
Diffstat (limited to 'src')
-rw-r--r-- | src/setu/gnunet-service-setu.c | 30 | ||||
-rw-r--r-- | src/setu/perf_setu_api.c | 2 | ||||
-rw-r--r-- | src/setu/setu.h | 1 |
3 files changed, 31 insertions, 2 deletions
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 5799908ba..58717909e 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c | |||
@@ -666,15 +666,21 @@ struct perf_rtt_struct | |||
666 | struct perf_rtt_struct perf_rtt; | 666 | struct perf_rtt_struct perf_rtt; |
667 | 667 | ||
668 | 668 | ||
669 | static int | ||
670 | sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) { | ||
671 | return (size * perf_rtt_struct.sent) + (size * perf_rtt_struct.received); | ||
672 | } | ||
673 | |||
669 | static float | 674 | static float |
670 | calculate_perf_rtt() { | 675 | calculate_perf_rtt() { |
671 | /** | 676 | /** |
672 | * Calculate RTT of init phase normally always 1 | 677 | * Calculate RTT of init phase normally always 1 |
673 | */ | 678 | */ |
674 | float rtt = 1; | 679 | float rtt = 1; |
680 | int bytes_transmitted = 0; | ||
675 | 681 | ||
676 | /** | 682 | /** |
677 | * Calculate RRT of Fullsync normaly 1 or 1.5 depending | 683 | * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending |
678 | */ | 684 | */ |
679 | if (( perf_rtt.element_full.received != 0 ) || | 685 | if (( perf_rtt.element_full.received != 0 ) || |
680 | ( perf_rtt.element_full.sent != 0) | 686 | ( perf_rtt.element_full.sent != 0) |
@@ -694,6 +700,24 @@ calculate_perf_rtt() { | |||
694 | rtt += (iterations - 1 ) * 0.5; | 700 | rtt += (iterations - 1 ) * 0.5; |
695 | rtt += 3 * iterations; | 701 | rtt += 3 * iterations; |
696 | 702 | ||
703 | /** | ||
704 | * Calculate data sended size | ||
705 | */ | ||
706 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL), perf_rtt.request_full); | ||
707 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT), perf_rtt.element_full); | ||
708 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS), perf_rtt.element); | ||
709 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST), perf_rtt.operation_request); | ||
710 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_SE), perf_rtt.se); | ||
711 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE), perf_rtt.full_done); | ||
712 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_IBF), perf_rtt.ibf); | ||
713 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY), perf_rtt.inquery); | ||
714 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND), perf_rtt.demand); | ||
715 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER), perf_rtt.offer); | ||
716 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DONE), perf_rtt.done); | ||
717 | |||
718 | LOG(GNUNET_ERROR_TYPE_ERROR,"Bytes Transmitted: %d\n", bytes_transmitted); | ||
719 | |||
720 | |||
697 | return rtt; | 721 | return rtt; |
698 | } | 722 | } |
699 | 723 | ||
@@ -1513,6 +1537,10 @@ handle_union_p2p_strata_estimator (void *cls, | |||
1513 | return; | 1537 | return; |
1514 | } | 1538 | } |
1515 | 1539 | ||
1540 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1541 | "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: %f\n", op->rtt_bandwidth_tradeoff); | ||
1542 | |||
1543 | |||
1516 | /** | 1544 | /** |
1517 | * Added rtt_bandwidth_tradeoff directly need future improvements | 1545 | * Added rtt_bandwidth_tradeoff directly need future improvements |
1518 | */ | 1546 | */ |
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c index 73b61c02a..990e69ea8 100644 --- a/src/setu/perf_setu_api.c +++ b/src/setu/perf_setu_api.c | |||
@@ -395,7 +395,7 @@ run (void *cls, | |||
395 | "Running real set-reconciliation\n"); | 395 | "Running real set-reconciliation\n"); |
396 | //init_set1 (); | 396 | //init_set1 (); |
397 | // limit ~23800 element total | 397 | // limit ~23800 element total |
398 | initRandomSets(88,100,90,32); | 398 | initRandomSets(0,200,400,32); |
399 | } | 399 | } |
400 | 400 | ||
401 | static void execute_perf() | 401 | static void execute_perf() |
diff --git a/src/setu/setu.h b/src/setu/setu.h index e9a0def95..f806c8eb1 100644 --- a/src/setu/setu.h +++ b/src/setu/setu.h | |||
@@ -121,6 +121,7 @@ struct GNUNET_SETU_AcceptMessage | |||
121 | * byzantine mode is enabled. | 121 | * byzantine mode is enabled. |
122 | */ | 122 | */ |
123 | uint32_t byzantine_lower_bound; | 123 | uint32_t byzantine_lower_bound; |
124 | |||
124 | }; | 125 | }; |
125 | 126 | ||
126 | 127 | ||