[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 03/164: Added multitreading
From: |
gnunet |
Subject: |
[gnunet] 03/164: Added multitreading |
Date: |
Fri, 30 Jul 2021 15:31:09 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 3be16a6d72348a74e9fda9299fc22581caa250bb
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sat Apr 3 18:56:04 2021 +0200
Added multitreading
---
src/setu/gnunet-service-setu.c | 25 +++++++++++---
src/setu/perf_setu_api.c | 77 +++++++++++++++++++++++++++++-------------
2 files changed, 75 insertions(+), 27 deletions(-)
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 6d0693524..1d648748b 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -783,12 +783,29 @@ calculate_perf_rtt() {
LOG(GNUNET_ERROR_TYPE_ERROR,"Estimateded set difference: %d\n",
perf_rtt.se_diff);
+ /*
+ * Write IBF failure rate for different BUCKET_NUMBER_FACTOR
+ */
+ float factor;
+ GNUNET_CONFIGURATION_get_value_float(setu_cfg,"IBF",
"BUCKET_NUMBER_FACTOR", &factor);
+ int num_per_bucket;
+ GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET",
&num_per_bucket);
+
+ int decoded = 0;
+ if(perf_rtt.active_passive_switches == 0)
+ decoded = 1;
+
+ FILE *out1 = fopen("perf_failure_bucket_number_factor.csv", "a");
+ fprintf(out1, "%d,%f,%d\n",num_per_bucket,factor,decoded);
+ fclose(out1);
+
/**
- * Write performance csv output
- * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt>
- */
- FILE *out = fopen("perfstats.log", "a");
+ * Write performance csv output
+ * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt>
+ */
+
+ FILE *out = fopen("perf_stats.csv", "a");
fprintf(out, "%d,%d,%d,%f\n", perf_rtt.se_diff,
perf_rtt.active_passive_switches,bytes_transmitted,rtt);
fclose(out);
return 0;
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index a0e5ba279..aa1f9ed19 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -27,6 +27,8 @@
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "gnunet_setu_service.h"
+#include <sys/sysinfo.h>
+#include <pthread.h>
static struct GNUNET_PeerIdentity local_id;
@@ -405,36 +407,65 @@ run (void *cls,
initRandomSets(450,500,500,32);
}
-static void execute_perf()
-{
- setu_cfg = GNUNET_CONFIGURATION_create ();
- GNUNET_CONFIGURATION_set_value_string (setu_cfg, "IBF",
"BUCKET_NUMBER_FACTOR", "1"); // Factor default=4
- GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF",
"NUMBER_PER_BUCKET", 4); // K default=4
- GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE",
"TRADEOFF", "0.25");
- GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE",
"MAX_SET_DIFF_FACTOR_DIFFERENTIAL", "0.25"); //default=4
+static void perf_thread(void *arg) {
+ GNUNET_TESTING_service_run("perf_setu_api",
+ "arm",
+ "test_setu.conf",
+ &run,
+ NULL);
+ return NULL;
+}
+
+
+static void run_petf_thread(int total_runs) {
+ int core_count=get_nprocs_conf();
+ for(int runs = 0; runs < total_runs; runs += core_count) {
+ pthread_t tid[core_count];
+
+ for (int i = 0; i < core_count; i++) {
+ pthread_create(&tid[i], NULL, perf_thread, NULL);
+ }
+
+ for (int i = 0; i < core_count; i++)
+ pthread_join(tid[i], NULL);
+ }
+
+}
+
+static void execute_perf() {
/**
- * Erase statfile
- */
- remove("perfstats.log");
+ * Erase statfile
+ */
+ remove("perf_stats.csv");
+ remove("perf_failure_bucket_number_factor.csv");
//FILE *out = fopen("perfstats.log", "w");
//fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n");
- if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg,
"/tmp/perf_setu.conf"))
- GNUNET_log (
- GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to write subsystem default identifier map to
`%s'.\n"),
- setu_cfg);
- for( int repeat_ctr = 0; repeat_ctr<100; repeat_ctr++ ) {
+ for (int out_out_ctr = 1; out_out_ctr <= 10; out_out_ctr++) {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Executing perf round %d\n", repeat_ctr);
+ for (int out_ctr = 0; out_ctr <= 100; out_ctr++) {
- GNUNET_TESTING_service_run ("perf_setu_api",
- "arm",
- "test_setu.conf",
- &run,
- NULL);
+ float base = 0.1;
+ float x = out_ctr * base;
+ char factor[10];
+ gcvt(x, 4, factor);
+
+ 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_string(setu_cfg, "PERFORMANCE",
"MAX_SET_DIFF_FACTOR_DIFFERENTIAL",
+ "0.25");//default=4
+
+
+ if (GNUNET_OK != GNUNET_CONFIGURATION_write(setu_cfg,
"/tmp/perf_setu.conf"))
+ GNUNET_log(
+ GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to write subsystem default identifier map to
`%s'.\n"),
+ setu_cfg);
+ run_petf_thread(100);
+ }
}
return 0;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (e8eb1ecc0 -> 24bc8b102), gnunet, 2021/07/30
- [gnunet] 06/164: added thread lib to setu perf, gnunet, 2021/07/30
- [gnunet] 07/164: Fixed, gnunet, 2021/07/30
- [gnunet] 08/164: Fixed some stack smashing error ;-), gnunet, 2021/07/30
- [gnunet] 10/164: Fixed bug in perfomance forking, gnunet, 2021/07/30
- [gnunet] 01/164: Working, gnunet, 2021/07/30
- [gnunet] 03/164: Added multitreading,
gnunet <=
- [gnunet] 14/164: Increased set difference for test by x10, gnunet, 2021/07/30
- [gnunet] 17/164: Perf test with bytes send/resived per ibf, gnunet, 2021/07/30
- [gnunet] 09/164: Added forking to perf test, gnunet, 2021/07/30
- [gnunet] 15/164: Perf run to test with bigger element set, gnunet, 2021/07/30
- [gnunet] 33/164: Make 5000 elements perftest for perftest, gnunet, 2021/07/30
- [gnunet] 16/164: Perf run to test with bigger element set smaller set, gnunet, 2021/07/30
- [gnunet] 25/164: Simulation with 10x less elements & Removed some debuging statements, gnunet, 2021/07/30
- [gnunet] 35/164: Add total bytes transmitted to perf, gnunet, 2021/07/30
- [gnunet] 19/164: Run generate missing data, gnunet, 2021/07/30
- [gnunet] 27/164: Fixed fork doubeling, gnunet, 2021/07/30