aboutsummaryrefslogtreecommitdiff
path: root/src/setu/gnunet-service-setu.c
diff options
context:
space:
mode:
authorElias Summermatter <elias.summermatter@seccom.ch>2021-04-02 16:43:26 +0200
committerElias Summermatter <elias.summermatter@seccom.ch>2021-04-02 16:43:26 +0200
commit265bdcd1370e1764d538184040edbb380e6fbf93 (patch)
treee118d460f8a0040bc830bbe22c286010c7aa391b /src/setu/gnunet-service-setu.c
parent026ced682652a1a19dd8a7e9fe45c22fa5d38aca (diff)
downloadgnunet-265bdcd1370e1764d538184040edbb380e6fbf93.tar.gz
gnunet-265bdcd1370e1764d538184040edbb380e6fbf93.zip
Made all required perfomance parameters costumizable
Diffstat (limited to 'src/setu/gnunet-service-setu.c')
-rw-r--r--src/setu/gnunet-service-setu.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index e5d23af2e..fb1c9a99d 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -421,9 +421,10 @@ struct Operation
421 421
422 422
423 /** 423 /**
424 * Number of buckets in IBF 424 * Set difference is multiplied with this factor
425 * to gennerate large enought IBF
425 */ 426 */
426 unsigned int ibf_bucket_number; 427 float ibf_bucket_number_factor;
427 428
428}; 429};
429 430
@@ -699,9 +700,8 @@ load_config(struct Operation * op) {
699 700
700 long long number; 701 long long number;
701 float fl; 702 float fl;
702 GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "BUCKET_NUMBER", &number); 703 GNUNET_CONFIGURATION_get_value_float(setu_cfg,"IBF", "BUCKET_NUMBER_FACTOR", &fl);
703 704 op->ibf_bucket_number_factor = fl;
704 op->ibf_bucket_number = number;
705 705
706 GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", &number); 706 GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", &number);
707 op->ibf_number_buckets_per_element = number; 707 op->ibf_number_buckets_per_element = number;
@@ -712,7 +712,7 @@ load_config(struct Operation * op) {
712 GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", &fl); 712 GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", &fl);
713 op->max_set_diff_factor_diff_sync = fl; 713 op->max_set_diff_factor_diff_sync = fl;
714 714
715 LOG(GNUNET_ERROR_TYPE_ERROR,"LOAD CONFIG\n"); 715 LOG(GNUNET_ERROR_TYPE_ERROR,"LOAD CONFIG: %d\n", op->ibf_number_buckets_per_element);
716 716
717} 717}
718 718
@@ -746,6 +746,7 @@ calculate_perf_rtt() {
746 ( perf_rtt.request_full.sent != 0) 746 ( perf_rtt.request_full.sent != 0)
747 ) rtt += 0.5; 747 ) rtt += 0.5;
748 748
749 LOG(GNUNET_ERROR_TYPE_ERROR,"RTTTTTTTTTTTTTT2: %f \n", rtt);
749 /** 750 /**
750 * In case of a differential sync 3 rtt's are needed. 751 * In case of a differential sync 3 rtt's are needed.
751 * for every active/passive switch additional 3.5 rtt's are used 752 * for every active/passive switch additional 3.5 rtt's are used
@@ -758,6 +759,7 @@ calculate_perf_rtt() {
758 rtt += iterations * 0.5; 759 rtt += iterations * 0.5;
759 rtt += 2.5; 760 rtt += 2.5;
760 } 761 }
762 LOG(GNUNET_ERROR_TYPE_ERROR,"RTTTTTTTTTTTTTT3: %d \n", perf_rtt.active_passive_switches);
761 763
762 /** 764 /**
763 * Calculate data sended size 765 * Calculate data sended size
@@ -1325,7 +1327,8 @@ prepare_ibf (struct Operation *op,
1325 1327
1326 if (NULL != op->local_ibf) 1328 if (NULL != op->local_ibf)
1327 ibf_destroy (op->local_ibf); 1329 ibf_destroy (op->local_ibf);
1328 op->local_ibf = ibf_create (size, SE_IBF_HASH_NUM); 1330 //op->local_ibf = ibf_create (size, SE_IBF_HASH_NUM);
1331 op->local_ibf = ibf_create (size, ((uint8_t) op->ibf_number_buckets_per_element));
1329 if (NULL == op->local_ibf) 1332 if (NULL == op->local_ibf)
1330 { 1333 {
1331 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1334 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1421,16 +1424,18 @@ send_ibf (struct Operation *op,
1421 * @return the required size of the ibf 1424 * @return the required size of the ibf
1422 */ 1425 */
1423static unsigned int 1426static unsigned int
1424get_order_from_difference (unsigned int diff) 1427get_order_from_difference (unsigned int diff, int number_buckets_per_element, float ibf_bucket_number_factor)
1425{ 1428{
1426 unsigned int ibf_order; 1429 unsigned int ibf_order;
1427 1430
1428 ibf_order = 2; 1431 ibf_order = 2;
1429 while (((1 << ibf_order) < (IBF_ALPHA * diff) || 1432 while (((1 << ibf_order) < (ibf_bucket_number_factor * diff) ||
1430 ((1 << ibf_order) < SE_IBF_HASH_NUM)) && 1433 ((1 << ibf_order) < number_buckets_per_element)) &&
1431 (ibf_order < MAX_IBF_ORDER)) 1434 (ibf_order < MAX_IBF_ORDER))
1432 ibf_order++; 1435 ibf_order++;
1433 // add one for correction 1436 // add one for correction
1437 LOG (GNUNET_ERROR_TYPE_ERROR,"IBF ORDER: %d\n", ibf_order);
1438
1434 return ibf_order + 1; 1439 return ibf_order + 1;
1435} 1440}
1436 1441
@@ -1592,7 +1597,7 @@ handle_union_p2p_strata_estimator (void *cls,
1592 LOG (GNUNET_ERROR_TYPE_DEBUG, 1597 LOG (GNUNET_ERROR_TYPE_DEBUG,
1593 "got se diff=%d, using ibf size %d\n", 1598 "got se diff=%d, using ibf size %d\n",
1594 diff, 1599 diff,
1595 1U << get_order_from_difference (diff)); 1600 1U << get_order_from_difference (diff, op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor));
1596 1601
1597 { 1602 {
1598 char *set_debug; 1603 char *set_debug;
@@ -1660,7 +1665,7 @@ LOG (GNUNET_ERROR_TYPE_ERROR, "VALUE: %f\n ",op->max_set_diff_factor_diff_sync);
1660 GNUNET_NO); 1665 GNUNET_NO);
1661 if (GNUNET_OK != 1666 if (GNUNET_OK !=
1662 send_ibf (op, 1667 send_ibf (op,
1663 get_order_from_difference (diff))) 1668 get_order_from_difference (diff, op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor)))
1664 { 1669 {
1665 /* Internal error, best we can do is shut the connection */ 1670 /* Internal error, best we can do is shut the connection */
1666 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1671 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1992,7 +1997,8 @@ handle_union_p2p_ibf (void *cls,
1992 LOG (GNUNET_ERROR_TYPE_DEBUG, 1997 LOG (GNUNET_ERROR_TYPE_DEBUG,
1993 "Creating new ibf of size %u\n", 1998 "Creating new ibf of size %u\n",
1994 1 << msg->order); 1999 1 << msg->order);
1995 op->remote_ibf = ibf_create (1 << msg->order, SE_IBF_HASH_NUM); 2000 // op->remote_ibf = ibf_create (1 << msg->order, SE_IBF_HASH_NUM);
2001 op->remote_ibf = ibf_create (1 << msg->order, ((uint8_t) op->ibf_number_buckets_per_element));
1996 op->salt_receive = ntohl (msg->salt); 2002 op->salt_receive = ntohl (msg->salt);
1997 LOG (GNUNET_ERROR_TYPE_DEBUG, 2003 LOG (GNUNET_ERROR_TYPE_DEBUG,
1998 "Receiving new IBF with salt %u\n", 2004 "Receiving new IBF with salt %u\n",
@@ -3785,6 +3791,9 @@ handle_client_accept (void *cls,
3785 op->force_delta = msg->force_delta; 3791 op->force_delta = msg->force_delta;
3786 op->symmetric = msg->symmetric; 3792 op->symmetric = msg->symmetric;
3787 3793
3794 /* load config */
3795 load_config(op);
3796
3788 /* Advance generation values, so that future mutations do not 3797 /* Advance generation values, so that future mutations do not
3789 interfer with the running operation. */ 3798 interfer with the running operation. */
3790 op->generation_created = set->current_generation; 3799 op->generation_created = set->current_generation;