gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 64/164: Added strate remote/local set estimation


From: gnunet
Subject: [gnunet] 64/164: Added strate remote/local set estimation
Date: Fri, 30 Jul 2021 15:32:10 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit 008f61fde68e1c8299b717c346e5935174ca71f7
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Thu Apr 22 23:37:17 2021 +0200

    Added strate remote/local set estimation
---
 src/setu/gnunet-service-setu.c                  | 13 ++++++++++++-
 src/setu/gnunet-service-setu_strata_estimator.c |  4 ++++
 src/setu/ibf.c                                  |  6 ++++++
 src/setu/ibf.h                                  | 14 ++++++++++++++
 src/setu/perf_setu_api.c                        |  2 +-
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 1d206e598..69086a504 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -704,6 +704,8 @@ struct perf_rtt_struct
     struct perf_num_send_resived_msg done;
     struct perf_num_send_resived_msg over;
     int se_diff;
+    int se_diff_remote;
+    int se_diff_local;
     int active_passive_switches;
 };
 
@@ -834,7 +836,7 @@ calculate_perf_rtt() {
 
 
     FILE *out1 = fopen("perf_failure_bucket_number_factor.csv", "a");
-    fprintf(out1, 
"%d,%f,%d,%d,%f,%d,%d\n",num_per_bucket,factor,decoded,ibf_bytes_transmitted,rtt,perf_rtt.se_diff,bytes_transmitted);
+    fprintf(out1, 
"%d,%f,%d,%d,%f,%d,%d,%d,%d\n",num_per_bucket,factor,decoded,ibf_bytes_transmitted,rtt,perf_rtt.se_diff,bytes_transmitted,perf_rtt.se_diff_local,perf_rtt.se_diff_remote);
     fclose(out1);
 
 
@@ -1648,6 +1650,15 @@ handle_union_p2p_strata_estimator (void *cls,
   diff = strata_estimator_difference (remote_se,
                                       op->se);
 
+  /* Calculate remote local diff */
+  int remote_elements_decoded = remote_se->strata[0]->remote_decoded_count;
+  int local_elements_decoded = remote_se->strata[0]->local_decoded_count;
+
+  int total_decoded = remote_elements_decoded + local_elements_decoded;
+  int diff_remote = ((float)remote_elements_decoded / (float)total_decoded) * 
diff;
+  int diff_local = ((float)local_elements_decoded / (float)total_decoded) * 
diff;
+  perf_rtt.se_diff_local = diff_local;
+  perf_rtt.se_diff_remote = diff_remote;
   perf_rtt.se_diff = diff;
 
   /**
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c 
b/src/setu/gnunet-service-setu_strata_estimator.c
index 7c9a4deb6..d23759b8c 100644
--- a/src/setu/gnunet-service-setu_strata_estimator.c
+++ b/src/setu/gnunet-service-setu_strata_estimator.c
@@ -239,6 +239,8 @@ strata_estimator_difference (const struct StrataEstimator 
*se1,
                          NULL);
       if (GNUNET_NO == more)
       {
+        se1->strata[0]->local_decoded_count += diff->local_decoded_count * (1 
<< (i + 1));
+        se1->strata[0]->remote_decoded_count += diff->remote_decoded_count * 
(1 << (i + 1));
         count += ibf_count;
         break;
       }
@@ -246,6 +248,8 @@ strata_estimator_difference (const struct StrataEstimator 
*se1,
       if ( (GNUNET_SYSERR == more) ||
            (ibf_count > diff->size) )
       {
+        se1->strata[0]->local_decoded_count = 
se1->strata[0]->local_decoded_count * (1 << (i + 1));
+        se1->strata[0]->remote_decoded_count = 
se1->strata[0]->remote_decoded_count * (1 << (i + 1));
         ibf_destroy (diff);
         return count * (1 << (i + 1));
       }
diff --git a/src/setu/ibf.c b/src/setu/ibf.c
index 36138f856..2f436eff1 100644
--- a/src/setu/ibf.c
+++ b/src/setu/ibf.c
@@ -252,6 +252,12 @@ ibf_decode (struct InvertibleBloomFilter *ibf,
          (-1 != ibf->count[i].count_val) )
       continue;
 
+    if (1 == ibf->count[i].count_val) {
+        ibf->remote_decoded_count++;
+    } else {
+        ibf->local_decoded_count++;
+    }
+
     hash.key_hash_val = IBF_KEY_HASH_VAL (ibf->key_sum[i]);
 
     /* test if the hash matches the key */
diff --git a/src/setu/ibf.h b/src/setu/ibf.h
index 7c2ab33b1..1969c4d84 100644
--- a/src/setu/ibf.h
+++ b/src/setu/ibf.h
@@ -92,6 +92,20 @@ struct InvertibleBloomFilter
    */
   uint8_t hash_num;
 
+    /**
+   * If an IBF is decoded this count stores how many
+   * elements are on the local site. This is used
+   * to estimate the set difference on a site
+   */
+    int local_decoded_count;
+
+    /**
+   * If an IBF is decoded this count stores how many
+   * elements are on the remote site. This is used
+   * to estimate the set difference on a site
+   */
+    int remote_decoded_count;
+
   /**
    * Xor sums of the elements' keys, used to identify the elements.
    * Array of 'size' elements.
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index a959a4f49..d9049c5be 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -404,7 +404,7 @@ run (void *cls,
                 "Running real set-reconciliation\n");
     //init_set1 ();
     // limit ~23800 element total
-    initRandomSets(4990,5000,5000,32);
+    initRandomSets(4000,4500,5000,32);
 }
 
 void perf_thread() {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]