[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 101/164: Added element avg calculation
From: |
gnunet |
Subject: |
[gnunet] 101/164: Added element avg calculation |
Date: |
Fri, 30 Jul 2021 15:32:47 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit b5b29acc41136beb17f7cfa7fdc101d19864b2dd
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Tue May 18 15:05:19 2021 +0200
Added element avg calculation
---
src/setu/gnunet-service-setu.c | 61 +++++++++++++++++++++++++++++++++---------
src/setu/perf_setu_api.c | 23 ++++++++++++----
2 files changed, 66 insertions(+), 18 deletions(-)
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 8139ec7d7..dc1ec04cc 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -483,6 +483,16 @@ struct Operation
* Hashmap to keep track of the send/received inquiries (ibf keys)
*/
struct GNUNET_CONTAINER_MultiHashMap *inquiries_sent;
+
+ /**
+ * Number of element in local set
+ */
+ uint64_t number_elements_local;
+
+ /**
+ * Total size of local set
+ */
+ uint64_t total_elements_size_local;
};
@@ -996,7 +1006,7 @@ static int check_valid_phase(uint8_t allowed_phases[],
size_t size_phases, struc
}
}
LOG (GNUNET_ERROR_TYPE_ERROR,
- "Received message in invalid phase phase: %u\n", op->phase);
+ "Received message in invalid phase: %u\n", op->phase);
return GNUNET_NO;
}
@@ -1009,20 +1019,18 @@ update_message_control_flow(struct
GNUNET_CONTAINER_MultiHashMap *hash_map,
{
struct message_control_flow_element *cfe = NULL;
enum MESSAGE_CONTROL_FLOW_STATE *mcfs;
-
+ /**
LOG (GNUNET_ERROR_TYPE_ERROR,
- "%u NEW_STATE %u\n", *hash_code->bits, new_mcfs);
+ "%u NEW_STATE %u\n", *hash_code->bits, new_mcfs); **/
cfe = GNUNET_CONTAINER_multihashmap_get(hash_map, hash_code);
if(NULL == cfe) {
cfe = (struct message_control_flow_element*)
GNUNET_malloc(sizeof(struct message_control_flow_element));
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "%u CREATE NEW!\n", *hash_code->bits);
}
-
+ /**
LOG (GNUNET_ERROR_TYPE_ERROR,
"ID: %u OFFER: %u DEMAND: %u ELEMEMT: %u %u\n", *hash_code->bits,
cfe->offer, cfe->demand, cfe->element);
-
+ **/
if ( OFFER_MESSAGE == mt) {
mcfs = &cfe->offer;
} else if ( DEMAND_MESSAGE == mt ) {
@@ -1041,19 +1049,19 @@ update_message_control_flow(struct
GNUNET_CONTAINER_MultiHashMap *hash_map,
} else {
return GNUNET_SYSERR;
}
-
+ /**
LOG (GNUNET_ERROR_TYPE_ERROR,
- "%u VALUE %u < %u \n", *hash_code->bits , new_mcfs, *mcfs);
+ "%u VALUE %u < %u \n", *hash_code->bits , new_mcfs, *mcfs); **/
if(new_mcfs <= *mcfs) {
return GNUNET_NO;
}
*mcfs = new_mcfs;
-
+ /**
LOG (GNUNET_ERROR_TYPE_ERROR,
"ID: %u OFFER: %u DEMAND: %u ELEMEMT: %u\n", *hash_code->bits,
cfe->offer, cfe->demand, cfe->element);
-
+ **/
GNUNET_CONTAINER_multihashmap_put(hash_map,
hash_code,cfe,GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
return GNUNET_YES;
}
@@ -1087,6 +1095,27 @@ is_message_in_message_control_flow(struct
GNUNET_CONTAINER_MultiHashMap *hash_ma
}
+/**
+ * Iterator for determining average size
+ *
+ * @param cls the union operation `struct Operation *`
+ * @param key unused
+ * @param value the `struct ElementEntry *` to insert
+ * into the key-to-element mapping
+ * @return #GNUNET_YES (to continue iterating)
+ */
+static int
+determinate_avg_element_size_iterator (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
+{
+ struct Operation *op = cls;
+ struct GNUNET_SETU_Element *element = value;
+ op->number_elements_local += 1;
+ op->total_elements_size_local += element->size;
+ return GNUNET_YES;
+}
+
/**
* Iterator over hash map entries, called to
* destroy the linked list of colliding ibf key entries.
@@ -1910,7 +1939,13 @@ handle_union_p2p_strata_estimator (void *cls,
uint64_t diff_local = ((float)local_elements_decoded / (float)total_decoded)
* diff;
- op->mode_of_operation = estimate_best_mode_of_operation(32,
+ /** Calculate avg element size **/
+ GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements,
+
&determinate_avg_element_size_iterator,
+ op);
+ uint64_t avg_element_size = op->total_elements_size_local /
op->number_elements_local;
+
+ op->mode_of_operation = estimate_best_mode_of_operation(avg_element_size,
GNUNET_CONTAINER_multihashmap_size (
op->set->content->elements),
op->remote_element_count,
@@ -3386,7 +3421,7 @@ handle_union_p2p_done (void *cls,
return;
}
- perf_rtt.done.received += 1;
+ perf_rtt.done.received += 1;
switch (op->phase)
{
case PHASE_PASSIVE_DECODING:
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index 383d28e97..03ef0a652 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(200, 300,500,32);
+ initRandomSets(490, 500,500,32);
}
void perf_thread() {
@@ -425,6 +425,10 @@ static void run_petf_thread(int total_runs) {
//Father code (before child processes start)
for (int processed = 0; processed < total_runs;) {
for (int id = 0; id < core_count; id++) {
+ perf_thread();
+ processed += 1;
+ }
+ /**
if(processed >= total_runs) break;
if ((child_pid = fork()) == 0) {
@@ -434,6 +438,7 @@ static void run_petf_thread(int total_runs) {
processed += 1;
}
while ((wpid = wait(&status)) > 0);
+ **/
}
}
@@ -446,8 +451,8 @@ static void execute_perf() {
remove("perf_failure_bucket_number_factor.csv");
//FILE *out = fopen("perfstats.log", "w");
//fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n");
-
- for (int out_out_ctr = 3; out_out_ctr <= 3; out_out_ctr++) {
+ int full_diff_ctr=0;
+ for (int out_out_ctr = 3; out_out_ctr <= 4; out_out_ctr++) {
for (int out_ctr = 20; out_ctr <= 20; out_ctr++) {
float base = 0.1;
@@ -455,10 +460,18 @@ static void execute_perf() {
char factor[10];
gcvt(x, 4, factor);
+ char tradeoff[10] = "200000";
+ if((full_diff_ctr % 2) == 0) {
+ gcvt(0.25, 4, tradeoff);
+ } else {
+
+ }
+ full_diff_ctr++;
+
setu_cfg = GNUNET_CONFIGURATION_create();
GNUNET_CONFIGURATION_set_value_string(setu_cfg, "IBF",
"BUCKET_NUMBER_FACTOR", factor); // Factor default=4
- GNUNET_CONFIGURATION_set_value_number(setu_cfg, "IBF",
"NUMBER_PER_BUCKET", out_out_ctr); // K default=4
- GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE",
"TRADEOFF", "0.25");
+ GNUNET_CONFIGURATION_set_value_number(setu_cfg, "IBF",
"NUMBER_PER_BUCKET", 3); // K default=4
+ GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE",
"TRADEOFF", tradeoff); //default=0.25
GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE",
"MAX_SET_DIFF_FACTOR_DIFFERENTIAL",
"20000");//default=0.25
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 51/164: Extended look, (continued)
- [gnunet] 51/164: Extended look, gnunet, 2021/07/30
- [gnunet] 52/164: Try something, gnunet, 2021/07/30
- [gnunet] 61/164: Simulation, gnunet, 2021/07/30
- [gnunet] 73/164: Performance chech, gnunet, 2021/07/30
- [gnunet] 85/164: Perf test, gnunet, 2021/07/30
- [gnunet] 89/164: Perftest, gnunet, 2021/07/30
- [gnunet] 75/164: Final messurement, gnunet, 2021/07/30
- [gnunet] 74/164: Add new algo to determinate mode of operation, gnunet, 2021/07/30
- [gnunet] 95/164: Perftest, gnunet, 2021/07/30
- [gnunet] 98/164: Perftest, gnunet, 2021/07/30
- [gnunet] 101/164: Added element avg calculation,
gnunet <=
- [gnunet] 77/164: Added new algo to determine operation mode, gnunet, 2021/07/30
- [gnunet] 81/164: Perf test, gnunet, 2021/07/30
- [gnunet] 87/164: Perf test, gnunet, 2021/07/30
- [gnunet] 100/164: Added message flow control, gnunet, 2021/07/30
- [gnunet] 108/164: Added some more sec checks, gnunet, 2021/07/30
- [gnunet] 93/164: Perftest, gnunet, 2021/07/30
- [gnunet] 94/164: Perftest, gnunet, 2021/07/30
- [gnunet] 86/164: Perf test, gnunet, 2021/07/30
- [gnunet] 20/164: Run over night, gnunet, 2021/07/30
- [gnunet] 53/164: Reverte change to changes salt, gnunet, 2021/07/30