diff options
-rw-r--r-- | src/setu/gnunet-service-setu.c | 25 | ||||
-rw-r--r-- | 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 fb1c9a99d..d13285a69 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c | |||
@@ -783,12 +783,29 @@ calculate_perf_rtt() { | |||
783 | LOG(GNUNET_ERROR_TYPE_ERROR,"Estimateded set difference: %d\n", perf_rtt.se_diff); | 783 | LOG(GNUNET_ERROR_TYPE_ERROR,"Estimateded set difference: %d\n", perf_rtt.se_diff); |
784 | 784 | ||
785 | 785 | ||
786 | /* | ||
787 | * Write IBF failure rate for different BUCKET_NUMBER_FACTOR | ||
788 | */ | ||
789 | float factor; | ||
790 | GNUNET_CONFIGURATION_get_value_float(setu_cfg,"IBF", "BUCKET_NUMBER_FACTOR", &factor); | ||
791 | int num_per_bucket; | ||
792 | GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", &num_per_bucket); | ||
793 | |||
794 | int decoded = 0; | ||
795 | if(perf_rtt.active_passive_switches == 0) | ||
796 | decoded = 1; | ||
797 | |||
798 | FILE *out1 = fopen("perf_failure_bucket_number_factor.csv", "a"); | ||
799 | fprintf(out1, "%d,%f,%d\n",num_per_bucket,factor,decoded); | ||
800 | fclose(out1); | ||
801 | |||
786 | 802 | ||
787 | /** | 803 | /** |
788 | * Write performance csv output | 804 | * Write performance csv output |
789 | * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt> | 805 | * <se_diff>,<active_passive_switches>,<bytes_transmitted>,<rtt> |
790 | */ | 806 | */ |
791 | FILE *out = fopen("perfstats.log", "a"); | 807 | |
808 | FILE *out = fopen("perf_stats.csv", "a"); | ||
792 | fprintf(out, "%d,%d,%d,%f\n", perf_rtt.se_diff, perf_rtt.active_passive_switches,bytes_transmitted,rtt); | 809 | fprintf(out, "%d,%d,%d,%f\n", perf_rtt.se_diff, perf_rtt.active_passive_switches,bytes_transmitted,rtt); |
793 | fclose(out); | 810 | fclose(out); |
794 | return 0; | 811 | return 0; |
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c index a2fea6ff4..de9eb8c0d 100644 --- a/src/setu/perf_setu_api.c +++ b/src/setu/perf_setu_api.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
29 | #include "gnunet_setu_service.h" | 29 | #include "gnunet_setu_service.h" |
30 | #include <sys/sysinfo.h> | ||
31 | #include <pthread.h> | ||
30 | 32 | ||
31 | 33 | ||
32 | static struct GNUNET_PeerIdentity local_id; | 34 | static struct GNUNET_PeerIdentity local_id; |
@@ -405,36 +407,65 @@ run (void *cls, | |||
405 | initRandomSets(450,500,500,32); | 407 | initRandomSets(450,500,500,32); |
406 | } | 408 | } |
407 | 409 | ||
408 | static void execute_perf() | 410 | static void perf_thread(void *arg) { |
409 | { | 411 | GNUNET_TESTING_service_run("perf_setu_api", |
410 | setu_cfg = GNUNET_CONFIGURATION_create (); | 412 | "arm", |
411 | GNUNET_CONFIGURATION_set_value_string (setu_cfg, "IBF", "BUCKET_NUMBER_FACTOR", "1"); // Factor default=4 | 413 | "test_setu.conf", |
412 | GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF", "NUMBER_PER_BUCKET", 4); // K default=4 | 414 | &run, |
413 | GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "TRADEOFF", "0.25"); | 415 | NULL); |
414 | GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", "0.25"); //default=4 | 416 | return NULL; |
417 | } | ||
418 | |||
419 | |||
420 | static void run_petf_thread(int total_runs) { | ||
421 | int core_count=get_nprocs_conf(); | ||
422 | for(int runs = 0; runs < total_runs; runs += core_count) { | ||
423 | pthread_t tid[core_count]; | ||
424 | |||
425 | for (int i = 0; i < core_count; i++) { | ||
426 | pthread_create(&tid[i], NULL, perf_thread, NULL); | ||
427 | } | ||
428 | |||
429 | for (int i = 0; i < core_count; i++) | ||
430 | pthread_join(tid[i], NULL); | ||
431 | } | ||
432 | |||
433 | } | ||
434 | |||
435 | static void execute_perf() { | ||
415 | 436 | ||
416 | /** | 437 | /** |
417 | * Erase statfile | 438 | * Erase statfile |
418 | */ | 439 | */ |
419 | remove("perfstats.log"); | 440 | remove("perf_stats.csv"); |
441 | remove("perf_failure_bucket_number_factor.csv"); | ||
420 | //FILE *out = fopen("perfstats.log", "w"); | 442 | //FILE *out = fopen("perfstats.log", "w"); |
421 | //fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n"); | 443 | //fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n"); |
422 | 444 | ||
423 | if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg, "/tmp/perf_setu.conf")) | 445 | for (int out_out_ctr = 1; out_out_ctr <= 10; out_out_ctr++) { |
424 | GNUNET_log ( | ||
425 | GNUNET_ERROR_TYPE_ERROR, | ||
426 | _ ("Failed to write subsystem default identifier map to `%s'.\n"), | ||
427 | setu_cfg); | ||
428 | for( int repeat_ctr = 0; repeat_ctr<100; repeat_ctr++ ) { | ||
429 | 446 | ||
430 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 447 | for (int out_ctr = 0; out_ctr <= 100; out_ctr++) { |
431 | "Executing perf round %d\n", repeat_ctr); | ||
432 | 448 | ||
433 | GNUNET_TESTING_service_run ("perf_setu_api", | 449 | float base = 0.1; |
434 | "arm", | 450 | float x = out_ctr * base; |
435 | "test_setu.conf", | 451 | char factor[10]; |
436 | &run, | 452 | gcvt(x, 4, factor); |
437 | NULL); | 453 | |
454 | setu_cfg = GNUNET_CONFIGURATION_create(); | ||
455 | GNUNET_CONFIGURATION_set_value_string(setu_cfg, "IBF", "BUCKET_NUMBER_FACTOR", factor); // Factor default=4 | ||
456 | GNUNET_CONFIGURATION_set_value_number(setu_cfg, "IBF", "NUMBER_PER_BUCKET", out_out_ctr); // K default=4 | ||
457 | GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE", "TRADEOFF", "0.25"); | ||
458 | GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE", "MAX_SET_DIFF_FACTOR_DIFFERENTIAL", | ||
459 | "0.25");//default=4 | ||
460 | |||
461 | |||
462 | if (GNUNET_OK != GNUNET_CONFIGURATION_write(setu_cfg, "/tmp/perf_setu.conf")) | ||
463 | GNUNET_log( | ||
464 | GNUNET_ERROR_TYPE_ERROR, | ||
465 | _("Failed to write subsystem default identifier map to `%s'.\n"), | ||
466 | setu_cfg); | ||
467 | run_petf_thread(100); | ||
468 | } | ||
438 | } | 469 | } |
439 | return 0; | 470 | return 0; |
440 | } | 471 | } |