diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-01 08:33:51 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-04-01 08:33:51 +0000 |
commit | 64113c89817a0a4b885da241f1445fee977d1718 (patch) | |
tree | 90d1ac09631b83a6e926bc8e2ce515e869373e82 /src/transport | |
parent | 30dc973129e613ad2ef112774af6e5ea49c08449 (diff) | |
download | gnunet-64113c89817a0a4b885da241f1445fee977d1718.tar.gz gnunet-64113c89817a0a4b885da241f1445fee977d1718.zip |
cleanup
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index def5b39e2..e88d256bc 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -5596,7 +5596,7 @@ struct ATS_result | |||
5596 | * @param res result struct | 5596 | * @param res result struct |
5597 | * @return GNUNET_SYSERR if glpk is not available, number of mechanisms used | 5597 | * @return GNUNET_SYSERR if glpk is not available, number of mechanisms used |
5598 | */ | 5598 | */ |
5599 | static int ats_create_problem (int max_it, int max_dur , double D, double U, double R, int v_b_min, int v_n_min, struct ATS_result *res) | 5599 | static int ats_solve_problem (int max_it, int max_dur , double D, double U, double R, int v_b_min, int v_n_min, struct ATS_result *res) |
5600 | { | 5600 | { |
5601 | #if !HAVE_LIBGLPK | 5601 | #if !HAVE_LIBGLPK |
5602 | if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "no glpk installed\n"); | 5602 | if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "no glpk installed\n"); |
@@ -6094,19 +6094,35 @@ static int ats_create_problem (int max_it, int max_dur , double D, double U, dou | |||
6094 | #endif | 6094 | #endif |
6095 | } | 6095 | } |
6096 | 6096 | ||
6097 | /* To remove: just for testing */ | 6097 | void ats_calculate_bandwidth_distribution () |
6098 | void ats_benchmark (int peers, int transports, int start_peers, int end_peers) | ||
6099 | { | 6098 | { |
6100 | static int glpk = GNUNET_YES; | 6099 | static int glpk = GNUNET_YES; |
6101 | struct GNUNET_TIME_Absolute start; | 6100 | struct GNUNET_TIME_Absolute start; |
6102 | struct GNUNET_TIME_Relative duration; | 6101 | struct GNUNET_TIME_Relative duration; |
6103 | int c_mechs = 0; | ||
6104 | struct ATS_result result; | 6102 | struct ATS_result result; |
6103 | int c_mechs = 0; | ||
6104 | |||
6105 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference(ats->last,GNUNET_TIME_absolute_get()); | ||
6106 | if (delta.rel_value < ats->min_delta.rel_value) | ||
6107 | { | ||
6108 | #if DEBUG_ATS | ||
6109 | GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Minimum time between cycles not reached\n"); | ||
6110 | #endif | ||
6111 | return; | ||
6112 | } | ||
6113 | |||
6114 | int dur = 500; | ||
6115 | if (INT_MAX < ats->max_exec_duration.rel_value) | ||
6116 | dur = INT_MAX; | ||
6117 | else | ||
6118 | dur = (int) ats->max_exec_duration.rel_value; | ||
6119 | |||
6120 | start = GNUNET_TIME_absolute_get(); | ||
6105 | 6121 | ||
6106 | if (glpk==GNUNET_YES) | 6122 | if (glpk==GNUNET_YES) |
6107 | { | 6123 | { |
6108 | start = GNUNET_TIME_absolute_get(); | 6124 | start = GNUNET_TIME_absolute_get(); |
6109 | c_mechs = ats_create_problem(5000, 5000, 1.0, 1.0, 1.0, 1000, 5, &result); | 6125 | c_mechs = ats_solve_problem(5000, 5000, 1.0, 1.0, 1.0, 1000, 5, &result); |
6110 | duration = GNUNET_TIME_absolute_get_difference(start,GNUNET_TIME_absolute_get()); | 6126 | duration = GNUNET_TIME_absolute_get_difference(start,GNUNET_TIME_absolute_get()); |
6111 | if (c_mechs > 0) | 6127 | if (c_mechs > 0) |
6112 | { | 6128 | { |
@@ -6123,48 +6139,6 @@ void ats_benchmark (int peers, int transports, int start_peers, int end_peers) | |||
6123 | } | 6139 | } |
6124 | else glpk = GNUNET_NO; | 6140 | else glpk = GNUNET_NO; |
6125 | } | 6141 | } |
6126 | } | ||
6127 | |||
6128 | void ats_calculate_bandwidth_distribution () | ||
6129 | { | ||
6130 | struct GNUNET_TIME_Relative delta = GNUNET_TIME_absolute_get_difference(ats->last,GNUNET_TIME_absolute_get()); | ||
6131 | if (delta.rel_value < ats->min_delta.rel_value) | ||
6132 | { | ||
6133 | #if DEBUG_ATS | ||
6134 | GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Minimum time between cycles not reached\n"); | ||
6135 | #endif | ||
6136 | return; | ||
6137 | } | ||
6138 | |||
6139 | struct GNUNET_TIME_Absolute start; | ||
6140 | /* | ||
6141 | int mlp = GNUNET_NO; | ||
6142 | int peers; | ||
6143 | int transports; | ||
6144 | |||
6145 | double b_min; | ||
6146 | double b_max; | ||
6147 | double r; | ||
6148 | double R; | ||
6149 | |||
6150 | int it = ATS_MAX_ITERATIONS; | ||
6151 | */ | ||
6152 | int dur = 500; | ||
6153 | if (INT_MAX < ats->max_exec_duration.rel_value) | ||
6154 | dur = INT_MAX; | ||
6155 | else | ||
6156 | dur = (int) ats->max_exec_duration.rel_value; | ||
6157 | |||
6158 | struct ATS_mechanism * tl = NULL; | ||
6159 | struct ATS_peer * pl = NULL; | ||
6160 | |||
6161 | start = GNUNET_TIME_absolute_get(); | ||
6162 | ats_benchmark(100,3,100,100); | ||
6163 | //ats_create_problem(peers, transports, b_min, b_max, r, R, pl, tl, it, dur, mlp); | ||
6164 | |||
6165 | GNUNET_free_non_null (pl); | ||
6166 | GNUNET_free_non_null (tl); | ||
6167 | |||
6168 | ats->last = GNUNET_TIME_absolute_get(); | 6142 | ats->last = GNUNET_TIME_absolute_get(); |
6169 | } | 6143 | } |
6170 | 6144 | ||