return GNUNET_SYSERR;
#else
if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "glpk installed\n");
-
+#endif
glp_prob *prob;
mechanisms[c_mechs].col_index = c_mechs;
mechanisms[c_mechs].peer = &peers[c_peers];
mechanisms[c_mechs].next = NULL;
+ mechanisms[c_mechs].plugin = r_next->plugin;
GNUNET_CONTAINER_DLL_insert_tail(peers[c_peers].m_head, peers[c_peers].m_tail, &mechanisms[c_mechs]);
c_mechs++;
default:
break;
}
-
- char * debug_solution = NULL;
- char * old = NULL;
- for (c=1; c<= (2*c_mechs) +3; c++ )
+#endif
+ int check;
+ double bw;
+ struct ATS_mechanism *t = NULL;
+ for (c=1; c<= (c_peers); c++ )
{
- old = debug_solution;
- GNUNET_asprintf(&debug_solution, "%s %s = %g;", (debug_solution!=NULL) ? debug_solution : "", glp_get_col_name(prob,c), glp_get_col_prim(prob, c));
- if (old!=NULL) GNUNET_free(old);
+ check = GNUNET_NO;
+ t = peers[c].m_head;
+ while (t!=NULL)
+ {
+ bw = glp_get_col_prim(prob, t->col_index);
+ GNUNET_assert (1);
+ if (bw != 0)
+ {
+ GNUNET_assert (check != GNUNET_YES);
+ check = GNUNET_YES;
+ if (VERBOSE_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[%i][%i] `%s' %s %s %f\n", c, t->col_index, GNUNET_h2s(&peers[c].peer.hashPubKey), t->plugin->short_name, glp_get_col_name(prob,t->col_index), bw);
+ }
+ t = t->next;
+ }
}
- old = debug_solution;
- GNUNET_asprintf(&debug_solution, "%s z = %g; \n", debug_solution, glp_get_obj_val(prob));
- if (old!=NULL) GNUNET_free(old);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s \n",debug_solution);
- GNUNET_free(debug_solution);
-#endif
-
res->c_mechs = c_mechs;
res->c_peers = c_peers;
res->solution = solution;
GNUNET_free(peers);
return c_mechs;
-#endif
+
}
void ats_calculate_bandwidth_distribution ()
static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
static GNUNET_SCHEDULER_TaskIdentifier stats_task;
-
struct GNUNET_TESTING_Daemon * master_deamon;
struct GNUNET_STATISTICS_Handle * stats;
static int peers;
static struct TEST_result results[MEASUREMENTS];
+struct GNUNET_STATISTICS_GetHandle * s_solution;
+struct GNUNET_STATISTICS_GetHandle * s_time;
+struct GNUNET_STATISTICS_GetHandle * s_peers;
+struct GNUNET_STATISTICS_GetHandle * s_mechs;
+struct GNUNET_STATISTICS_GetHandle * s_duration;
/**
* Check whether peers successfully shut down.
stats_task = GNUNET_SCHEDULER_NO_TASK;
}
+ if (s_time != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel(s_time);
+ s_time = NULL;
+ }
+ if (s_peers != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel(s_peers);
+ s_peers = NULL;
+ }
+ if (s_mechs != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel(s_mechs);
+ s_mechs = NULL;
+ }
+ if (s_solution != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel(s_solution);
+ s_solution = NULL;
+ }
+ if (s_duration != NULL)
+ {
+ GNUNET_STATISTICS_get_cancel(s_duration);
+ s_duration = NULL;
+ }
+
+
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
}
output = temp;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"%s\n",output);
+
+
shutdown_peers();
}
uint64_t value,
int is_persistent)
{
+ if (0 == strcmp (name,"ATS solution"))
+ {
+ s_solution = NULL;
+ }
+
+ if (0 == strcmp (name,"ATS peers"))
+ {
+ s_peers = NULL;
+ }
+
+ if (0 == strcmp (name,"ATS mechanisms"))
+ {
+ s_mechs = NULL;
+ }
+
+ if (0 == strcmp (name,"ATS duration"))
+ {
+ s_duration = NULL;
+ }
+ if (0 == strcmp (name,"ATS timestamp"))
+ {
+ s_time = NULL;
+ }
+
if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS peers")) && (value == peers-1))
{
measurement_started = GNUNET_YES;
r_index++;
if (r_index >= MEASUREMENTS)
{
+ if (stats_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel(stats_task);
+ stats_task = GNUNET_SCHEDULER_NO_TASK;
+ }
evaluate_measurements();
return GNUNET_NO;
}
if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
return;
- GNUNET_STATISTICS_get (stats, "transport", "ATS timestamp", TIMEOUT, NULL, &stats_cb, NULL);
- GNUNET_STATISTICS_get (stats, "transport", "ATS solution", TIMEOUT, NULL, &stats_cb, NULL);
- GNUNET_assert (NULL != GNUNET_STATISTICS_get (stats, "transport","ATS duration", TIMEOUT, NULL, &stats_cb, NULL));
- GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL);
- GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL);
+ s_time = GNUNET_STATISTICS_get (stats, "transport", "ATS timestamp", TIMEOUT, NULL, &stats_cb, NULL);
+ s_solution = GNUNET_STATISTICS_get (stats, "transport", "ATS solution", TIMEOUT, NULL, &stats_cb, NULL);
+ s_duration = GNUNET_STATISTICS_get (stats, "transport","ATS duration", TIMEOUT, NULL, &stats_cb, NULL);
+ s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, &stats_cb, NULL);
+ s_mechs = GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, NULL, &stats_cb, NULL);
stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL);
}