gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 09/164: Added forking to perf test


From: gnunet
Subject: [gnunet] 09/164: Added forking to perf test
Date: Fri, 30 Jul 2021 15:31:15 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 77ce1b1f4b6cbc2b2e93d87c218d103c71658456
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sat Apr 3 21:07:12 2021 +0200

    Added forking to perf test
---
 src/setu/gnunet-service-setu.c |  1 -
 src/setu/perf_setu_api.c       | 38 ++++++++++++++++++--------------------
 2 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index e4f2330bb..59a279f07 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -788,7 +788,6 @@ calculate_perf_rtt() {
      */
     float factor;
     GNUNET_CONFIGURATION_get_value_float(setu_cfg,"IBF", 
"BUCKET_NUMBER_FACTOR", &factor);
-    return;
     long long num_per_bucket;
     GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", 
&num_per_bucket);
 
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index 046e46fe7..14a96f782 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -407,31 +407,35 @@ run (void *cls,
     initRandomSets(450,500,500,32);
 }
 
-void *perf_thread() {
-
-    printf("OK\n");
-
+void perf_thread() {
     GNUNET_TESTING_service_run("perf_setu_api",
                                "arm",
                                "test_setu.conf",
                                &run,
                                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];
+    int core_count = get_nprocs_conf();
+    pid_t child_pid, wpid;
+    int status = 0;
 
-        for (int i = 0; i < core_count; i++) {
-            pthread_create(&tid[i], NULL, perf_thread, NULL);
-        }
+//Father code (before child processes start)
+    for (int processed = 0; processed < total_runs;) {
+        for (int id = 0; id < core_count; id++) {
 
-        for (int i = 0; i < core_count; i++)
-            pthread_join(tid[i], NULL);
-    }
+            if(processed >= total_runs) break;
 
+            if ((child_pid = fork()) == 0) {
+                perf_thread();
+                exit(0);
+            }
+            processed=+1;
+        }
+        while ((wpid = wait(&status)) > 0);
+    }
 }
 
 static void execute_perf() {
@@ -481,12 +485,6 @@ main (int argc, char **argv)
     GNUNET_log_setup ("perf_setu_api",
                       "WARNING",
                       NULL);
-
-    GNUNET_TESTING_service_run("perf_setu_api",
-                               "arm",
-                               "test_setu.conf",
-                               &run,
-                               NULL);
-    //execute_perf();
+    execute_perf();
     return 0;
 }

-- 
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]