diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-31 14:10:37 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-10-31 14:10:37 +0000 |
commit | 490060f2e0c66eb8db987e3b7d16db0c060533c2 (patch) | |
tree | fd2b1397da3ce8ff5470787cb57eb473df384ccf /src | |
parent | fff52507192299e66581692e832d7e4ecd58bf22 (diff) | |
download | gnunet-490060f2e0c66eb8db987e3b7d16db0c060533c2.tar.gz gnunet-490060f2e0c66eb8db987e3b7d16db0c060533c2.zip |
adding additional INFO
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/libgnunet_plugin_ats_mlp.c | 40 | ||||
-rw-r--r-- | src/ats/libgnunet_plugin_ats_proportional.c | 23 | ||||
-rwxr-xr-x | src/ats/libgnunet_plugin_ats_ril.c | 2 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 116 | ||||
-rw-r--r-- | src/include/gnunet_ats_plugin.h | 17 |
5 files changed, 100 insertions, 98 deletions
diff --git a/src/ats/libgnunet_plugin_ats_mlp.c b/src/ats/libgnunet_plugin_ats_mlp.c index f45c5fe0b..1d921776d 100644 --- a/src/ats/libgnunet_plugin_ats_mlp.c +++ b/src/ats/libgnunet_plugin_ats_mlp.c | |||
@@ -1078,10 +1078,12 @@ mlp_propagate_results (void *cls, | |||
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | static void notify (struct GAS_MLP_Handle *mlp, | 1080 | static void notify (struct GAS_MLP_Handle *mlp, |
1081 | enum GAS_Solver_Operation op, enum GAS_Solver_Status stat) | 1081 | enum GAS_Solver_Operation op, |
1082 | enum GAS_Solver_Status stat, | ||
1083 | enum GAS_Solver_Additional_Information add) | ||
1082 | { | 1084 | { |
1083 | if (NULL != mlp->env->info_cb) | 1085 | if (NULL != mlp->env->info_cb) |
1084 | mlp->env->info_cb (mlp->env->info_cb_cls, op, stat); | 1086 | mlp->env->info_cb (mlp->env->info_cb_cls, op, stat, add); |
1085 | } | 1087 | } |
1086 | /** | 1088 | /** |
1087 | * Solves the MLP problem | 1089 | * Solves the MLP problem |
@@ -1103,36 +1105,36 @@ GAS_mlp_solve_problem (void *solver) | |||
1103 | mlp->bulk_request ++; | 1105 | mlp->bulk_request ++; |
1104 | return GNUNET_NO; | 1106 | return GNUNET_NO; |
1105 | } | 1107 | } |
1106 | notify (mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS); | 1108 | notify (mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_NONE); |
1107 | 1109 | ||
1108 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers)) | 1110 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers)) |
1109 | { | 1111 | { |
1110 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS); | 1112 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE); |
1111 | return GNUNET_OK; /* No pending requests */ | 1113 | return GNUNET_OK; /* No pending requests */ |
1112 | } | 1114 | } |
1113 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->addresses)) | 1115 | if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->addresses)) |
1114 | { | 1116 | { |
1115 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS); | 1117 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE); |
1116 | return GNUNET_OK; /* No addresses available */ | 1118 | return GNUNET_OK; /* No addresses available */ |
1117 | } | 1119 | } |
1118 | 1120 | ||
1119 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) | 1121 | if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == mlp->mlp_prob_updated)) |
1120 | { | 1122 | { |
1121 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); | 1123 | LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n"); |
1122 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS); | 1124 | notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE); |
1123 | return GNUNET_OK; | 1125 | return GNUNET_OK; |
1124 | } | 1126 | } |
1125 | if (GNUNET_YES == mlp->mlp_prob_changed) | 1127 | if (GNUNET_YES == mlp->mlp_prob_changed) |
1126 | { | 1128 | { |
1127 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); | 1129 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); |
1128 | notify (mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS); | 1130 | notify (mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_MLP_FULL); |
1129 | mlp_delete_problem (mlp); | 1131 | mlp_delete_problem (mlp); |
1130 | if (GNUNET_SYSERR == mlp_create_problem (mlp)) | 1132 | if (GNUNET_SYSERR == mlp_create_problem (mlp)) |
1131 | { | 1133 | { |
1132 | notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL); | 1134 | notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, GAS_INFO_MLP_FULL); |
1133 | return GNUNET_SYSERR; | 1135 | return GNUNET_SYSERR; |
1134 | } | 1136 | } |
1135 | notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS); | 1137 | notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_MLP_FULL); |
1136 | mlp->control_param_lp.presolve = GLP_YES; | 1138 | mlp->control_param_lp.presolve = GLP_YES; |
1137 | mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */ | 1139 | mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */ |
1138 | } | 1140 | } |
@@ -1142,20 +1144,28 @@ GAS_mlp_solve_problem (void *solver) | |||
1142 | } | 1144 | } |
1143 | 1145 | ||
1144 | /* Run LP solver */ | 1146 | /* Run LP solver */ |
1147 | |||
1148 | notify (mlp, GAS_OP_SOLVE_LP_START, GAS_STAT_SUCCESS, | ||
1149 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : GAS_INFO_MLP_UPDATED); | ||
1145 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running LP solver %s\n", | 1150 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running LP solver %s\n", |
1146 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); | 1151 | (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); |
1147 | notify (mlp, GAS_OP_SOLVE_LP_START, GAS_STAT_SUCCESS); | ||
1148 | res_lp = mlp_solve_lp_problem (mlp); | 1152 | res_lp = mlp_solve_lp_problem (mlp); |
1149 | notify (mlp, GAS_OP_SOLVE_LP_STOP, (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL); | 1153 | notify (mlp, GAS_OP_SOLVE_LP_STOP, |
1154 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | ||
1155 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : GAS_INFO_MLP_UPDATED); | ||
1150 | 1156 | ||
1151 | 1157 | ||
1152 | /* Run MLP solver */ | 1158 | /* Run MLP solver */ |
1153 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); | 1159 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); |
1154 | notify (mlp, GAS_OP_SOLVE_MLP_START, GAS_STAT_SUCCESS); | 1160 | notify (mlp, GAS_OP_SOLVE_MLP_START, GAS_STAT_SUCCESS, |
1161 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : GAS_INFO_MLP_UPDATED); | ||
1155 | res_mip = mlp_solve_mlp_problem (mlp); | 1162 | res_mip = mlp_solve_mlp_problem (mlp); |
1156 | notify (mlp, GAS_OP_SOLVE_MLP_STOP, (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL); | 1163 | notify (mlp, GAS_OP_SOLVE_MLP_STOP, |
1157 | 1164 | (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | |
1158 | notify (mlp, GAS_OP_SOLVE_STOP, (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL); | 1165 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : GAS_INFO_MLP_UPDATED); |
1166 | notify (mlp, GAS_OP_SOLVE_STOP, | ||
1167 | (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL, | ||
1168 | (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : GAS_INFO_MLP_UPDATED); | ||
1159 | 1169 | ||
1160 | /* Save stats */ | 1170 | /* Save stats */ |
1161 | mlp->ps.lp_res = res_lp; | 1171 | mlp->ps.lp_res = res_lp; |
diff --git a/src/ats/libgnunet_plugin_ats_proportional.c b/src/ats/libgnunet_plugin_ats_proportional.c index 225485476..084e8cac0 100644 --- a/src/ats/libgnunet_plugin_ats_proportional.c +++ b/src/ats/libgnunet_plugin_ats_proportional.c | |||
@@ -549,12 +549,6 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
549 | unsigned long long assigned_quota_out = 0; | 549 | unsigned long long assigned_quota_out = 0; |
550 | struct AddressWrapper *cur; | 550 | struct AddressWrapper *cur; |
551 | 551 | ||
552 | if (GNUNET_YES == s->bulk_lock) | ||
553 | { | ||
554 | s->bulk_requests++; | ||
555 | return; | ||
556 | } | ||
557 | |||
558 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 552 | LOG(GNUNET_ERROR_TYPE_DEBUG, |
559 | "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n", | 553 | "Recalculate quota for network type `%s' for %u addresses (in/out): %llu/%llu \n", |
560 | net->desc, net->active_addresses, net->total_quota_in, | 554 | net->desc, net->active_addresses, net->total_quota_in, |
@@ -812,16 +806,31 @@ static void distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
812 | struct Network *n, | 806 | struct Network *n, |
813 | struct ATS_Address *address_except) | 807 | struct ATS_Address *address_except) |
814 | { | 808 | { |
809 | if (GNUNET_YES == s->bulk_lock) | ||
810 | { | ||
811 | s->bulk_requests++; | ||
812 | return; | ||
813 | } | ||
814 | |||
815 | if (NULL != n) | 815 | if (NULL != n) |
816 | { | 816 | { |
817 | if (NULL != s->env->info_cb) | ||
818 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | ||
817 | distribute_bandwidth (s, n, address_except); | 819 | distribute_bandwidth (s, n, address_except); |
820 | if (NULL != s->env->info_cb) | ||
821 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE); | ||
818 | } | 822 | } |
819 | else | 823 | else |
820 | { | 824 | { |
821 | int i; | 825 | int i; |
826 | if (NULL != s->env->info_cb) | ||
827 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
822 | for (i = 0; i < s->network_count; i++) | 828 | for (i = 0; i < s->network_count; i++) |
823 | distribute_bandwidth (s, &s->network_entries[i], NULL ); | 829 | distribute_bandwidth (s, &s->network_entries[i], NULL ); |
830 | if (NULL != s->env->info_cb) | ||
831 | s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); | ||
824 | } | 832 | } |
833 | |||
825 | } | 834 | } |
826 | 835 | ||
827 | /** | 836 | /** |
@@ -1112,7 +1121,7 @@ GAS_proportional_get_preferred_address (void *solver, | |||
1112 | 1121 | ||
1113 | fba_ctx.best->active = GNUNET_YES; | 1122 | fba_ctx.best->active = GNUNET_YES; |
1114 | addresse_increment (s, net_cur, GNUNET_NO, GNUNET_YES); | 1123 | addresse_increment (s, net_cur, GNUNET_NO, GNUNET_YES); |
1115 | distribute_bandwidth_in_network (s, net_cur, fba_ctx.best ); | 1124 | distribute_bandwidth_in_network (s, net_cur, fba_ctx.best); |
1116 | return fba_ctx.best; | 1125 | return fba_ctx.best; |
1117 | } | 1126 | } |
1118 | 1127 | ||
diff --git a/src/ats/libgnunet_plugin_ats_ril.c b/src/ats/libgnunet_plugin_ats_ril.c index e7ba42d6b..f7ae95b20 100755 --- a/src/ats/libgnunet_plugin_ats_ril.c +++ b/src/ats/libgnunet_plugin_ats_ril.c | |||
@@ -519,7 +519,7 @@ static void ril_inform (struct GAS_RIL_Handle *solver, | |||
519 | enum GAS_Solver_Operation op, enum GAS_Solver_Status stat) | 519 | enum GAS_Solver_Operation op, enum GAS_Solver_Status stat) |
520 | { | 520 | { |
521 | if (NULL != solver->plugin_envi->info_cb) | 521 | if (NULL != solver->plugin_envi->info_cb) |
522 | solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat); | 522 | solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat, GAS_INFO_NONE); |
523 | } | 523 | } |
524 | 524 | ||
525 | /** | 525 | /** |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 845326bcd..3f3627bc4 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -40,22 +40,22 @@ | |||
40 | #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 40 | #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
41 | "set datafile separator ';' \n" \ | 41 | "set datafile separator ';' \n" \ |
42 | "set title \"Execution time Proportional solver \" \n" \ | 42 | "set title \"Execution time Proportional solver \" \n" \ |
43 | "set xlabel \"Time in us\" \n" \ | 43 | "set xlabel \"Number of peers\" \n" \ |
44 | "set ylabel \"Bytes/s\" \n" \ | 44 | "set ylabel \"Execution time in us\" \n" \ |
45 | "set grid \n" | 45 | "set grid \n" |
46 | 46 | ||
47 | #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 47 | #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
48 | "set datafile separator ';' \n" \ | 48 | "set datafile separator ';' \n" \ |
49 | "set title \"Execution time MLP solver \" \n" \ | 49 | "set title \"Execution time MLP solver \" \n" \ |
50 | "set xlabel \"Time in us\" \n" \ | 50 | "set xlabel \"Number of peers\" \n" \ |
51 | "set ylabel \"Bytes/s\" \n" \ | 51 | "set ylabel \"Execution time in us\" \n" \ |
52 | "set grid \n" | 52 | "set grid \n" |
53 | 53 | ||
54 | #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \ | 54 | #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \ |
55 | "set datafile separator ';' \n" \ | 55 | "set datafile separator ';' \n" \ |
56 | "set title \"Execution time RIL solver \" \n" \ | 56 | "set title \"Execution time RIL solver \" \n" \ |
57 | "set xlabel \"Time in us\" \n" \ | 57 | "set xlabel \"Number of peers\" \n" \ |
58 | "set ylabel \"Bytes/s\" \n" \ | 58 | "set ylabel \"Execution time in us\" \n" \ |
59 | "set grid \n" | 59 | "set grid \n" |
60 | 60 | ||
61 | /** | 61 | /** |
@@ -375,8 +375,10 @@ perf_create_address (int cp, int ca) | |||
375 | } | 375 | } |
376 | 376 | ||
377 | static void | 377 | static void |
378 | solver_info_cb (void *cls, enum GAS_Solver_Operation op, | 378 | solver_info_cb (void *cls, |
379 | enum GAS_Solver_Status stat) | 379 | enum GAS_Solver_Operation op, |
380 | enum GAS_Solver_Status stat, | ||
381 | enum GAS_Solver_Additional_Information add) | ||
380 | { | 382 | { |
381 | 383 | ||
382 | struct Result *tmp; | 384 | struct Result *tmp; |
@@ -509,22 +511,14 @@ solver_info_cb (void *cls, enum GAS_Solver_Operation op, | |||
509 | } | 511 | } |
510 | 512 | ||
511 | static void | 513 | static void |
512 | write_gnuplot_script () | 514 | write_gnuplot_script (char * data_fn) |
513 | { | 515 | { |
514 | struct Result *cur; | ||
515 | struct Result *next; | ||
516 | struct GNUNET_DISK_FileHandle *f; | 516 | struct GNUNET_DISK_FileHandle *f; |
517 | char * gfn; | 517 | char * gfn; |
518 | char *data; | 518 | char *data; |
519 | char *template; | 519 | char *template; |
520 | int c_s; | 520 | |
521 | int index; | 521 | GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u.gnuplot", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); |
522 | int plot_d_total; | ||
523 | int plot_d_setup; | ||
524 | int plot_d_lp; | ||
525 | int plot_d_mlp; | ||
526 | |||
527 | GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); | ||
528 | f = GNUNET_DISK_file_open (gfn, | 522 | f = GNUNET_DISK_file_open (gfn, |
529 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 523 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
530 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 524 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
@@ -536,7 +530,6 @@ write_gnuplot_script () | |||
536 | } | 530 | } |
537 | 531 | ||
538 | /* Write header */ | 532 | /* Write header */ |
539 | |||
540 | switch (ph.ats_mode) { | 533 | switch (ph.ats_mode) { |
541 | case MODE_PROPORTIONAL: | 534 | case MODE_PROPORTIONAL: |
542 | template = GNUPLOT_PROP_TEMPLATE; | 535 | template = GNUPLOT_PROP_TEMPLATE; |
@@ -550,55 +543,37 @@ write_gnuplot_script () | |||
550 | default: | 543 | default: |
551 | break; | 544 | break; |
552 | } | 545 | } |
553 | |||
554 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) | 546 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template))) |
555 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | 547 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); |
556 | #if 0 | ||
557 | cur = ph.head->d_total; | ||
558 | if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
559 | plot_d_total = GNUNET_YES; | ||
560 | |||
561 | if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
562 | plot_d_total = GNUNET_YES; | ||
563 | if (cur->d_setup != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
564 | plot_d_setup = GNUNET_YES; | ||
565 | if (cur->d_lp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
566 | plot_d_lp = GNUNET_YES; | ||
567 | if (cur->d_mlp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us) | ||
568 | plot_d_mlp = GNUNET_YES; | ||
569 | |||
570 | |||
571 | GNUNET_asprintf (&data, "plot "\ | ||
572 | "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ | ||
573 | "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ | ||
574 | "%s\n", | ||
575 | "\n pause -1", | ||
576 | fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, | ||
577 | fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no); | ||
578 | |||
579 | GNUNET_free (data); | ||
580 | #endif | ||
581 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
582 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
583 | |||
584 | 548 | ||
585 | #if 0 | 549 | if (MODE_PROPORTIONAL == ph.ats_mode) |
586 | index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER; | ||
587 | for (c_s = 0; c_s < lp->peer->num_partners; c_s++) | ||
588 | { | 550 | { |
589 | GNUNET_asprintf (&data, "%s"\ | 551 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ |
590 | "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \ | 552 | "pause -1", |
591 | "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\ | 553 | data_fn, 3); |
592 | "%s\n", | 554 | } |
593 | (0 == c_s) ? "plot " :"", | 555 | if (MODE_MLP == ph.ats_mode) |
594 | fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, lp->peer->partners[c_s].dest->no, | 556 | { |
595 | fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, lp->peer->partners[c_s].dest->no, | 557 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve',\\\n" \ |
596 | (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1"); | 558 | "'%s' using 1:%u with lines title 'Time to setup',\\\n" |
597 | 559 | "'%s' using 1:%u with lines title 'Time to solve LP',\\\n" | |
598 | GNUNET_free (data); | 560 | "'%s' using 1:%u with lines title 'Total time to solve MLP'\n" \ |
599 | index += LOG_ITEMS_PER_PEER; | 561 | "pause -1", |
562 | data_fn, 3, | ||
563 | data_fn, 4, | ||
564 | data_fn, 5, | ||
565 | data_fn, 6); | ||
566 | } | ||
567 | if (MODE_RIL == ph.ats_mode) | ||
568 | { | ||
569 | GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time to solve'\n" \ | ||
570 | "pause -1", | ||
571 | data_fn, 3); | ||
600 | } | 572 | } |
601 | #endif | 573 | |
574 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | ||
575 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn); | ||
576 | GNUNET_free (data); | ||
602 | 577 | ||
603 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | 578 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) |
604 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); | 579 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn); |
@@ -624,21 +599,19 @@ evaluate () | |||
624 | 599 | ||
625 | if (ph.create_plot) | 600 | if (ph.create_plot) |
626 | { | 601 | { |
627 | GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u_data", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); | 602 | GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u.data", ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address); |
628 | f = GNUNET_DISK_file_open (data_fn, | 603 | f = GNUNET_DISK_file_open (data_fn, |
629 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, | 604 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, |
630 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 605 | GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
631 | if (NULL == f) | 606 | if (NULL == f) |
632 | { | 607 | { |
633 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", data_fn); | 608 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", data_fn); |
634 | GNUNET_free (data_fn); | ||
635 | return; | 609 | return; |
636 | } | 610 | } |
637 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; | 611 | data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n"; |
638 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) | 612 | if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data))) |
639 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", data_fn); | 613 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file `%s'\n", data_fn); |
640 | 614 | write_gnuplot_script (data_fn); | |
641 | write_gnuplot_script (); | ||
642 | } | 615 | } |
643 | 616 | ||
644 | next = ph.head; | 617 | next = ph.head; |
@@ -697,9 +670,7 @@ evaluate () | |||
697 | GNUNET_free (str_d_lp); | 670 | GNUNET_free (str_d_lp); |
698 | GNUNET_free (str_d_mlp); | 671 | GNUNET_free (str_d_mlp); |
699 | GNUNET_free (data); | 672 | GNUNET_free (data); |
700 | |||
701 | } | 673 | } |
702 | |||
703 | GNUNET_CONTAINER_DLL_remove (ph.head, ph.tail, cur); | 674 | GNUNET_CONTAINER_DLL_remove (ph.head, ph.tail, cur); |
704 | GNUNET_free (cur); | 675 | GNUNET_free (cur); |
705 | } | 676 | } |
@@ -707,11 +678,8 @@ evaluate () | |||
707 | if (GNUNET_YES == ph.create_plot) | 678 | if (GNUNET_YES == ph.create_plot) |
708 | { | 679 | { |
709 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) | 680 | if (GNUNET_SYSERR == GNUNET_DISK_file_close(f)) |
710 | { | ||
711 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", data_fn); | 681 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", data_fn); |
712 | GNUNET_free (data_fn); | 682 | GNUNET_free (data_fn); |
713 | } | ||
714 | |||
715 | } | 683 | } |
716 | } | 684 | } |
717 | 685 | ||
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h index 4e4a7e2b3..51a79db68 100644 --- a/src/include/gnunet_ats_plugin.h +++ b/src/include/gnunet_ats_plugin.h | |||
@@ -321,6 +321,19 @@ enum GAS_Solver_Status | |||
321 | }; | 321 | }; |
322 | 322 | ||
323 | /** | 323 | /** |
324 | * Status of the operation | ||
325 | */ | ||
326 | enum GAS_Solver_Additional_Information | ||
327 | { | ||
328 | GAS_INFO_NONE, | ||
329 | GAS_INFO_MLP_FULL, | ||
330 | GAS_INFO_MLP_UPDATED, | ||
331 | GAS_INFO_PROP_ALL, | ||
332 | GAS_INFO_PROP_SINGLE | ||
333 | }; | ||
334 | |||
335 | |||
336 | /** | ||
324 | * Callback to call with additional information | 337 | * Callback to call with additional information |
325 | * Used for measurement | 338 | * Used for measurement |
326 | * | 339 | * |
@@ -333,7 +346,9 @@ enum GAS_Solver_Status | |||
333 | */ | 346 | */ |
334 | typedef void | 347 | typedef void |
335 | (*GAS_solver_information_callback) (void *cls, | 348 | (*GAS_solver_information_callback) (void *cls, |
336 | enum GAS_Solver_Operation op, enum GAS_Solver_Status stat); | 349 | enum GAS_Solver_Operation op, |
350 | enum GAS_Solver_Status stat, | ||
351 | enum GAS_Solver_Additional_Information); | ||
337 | 352 | ||
338 | 353 | ||
339 | /** | 354 | /** |