[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20997 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20997 - gnunet/src/ats |
Date: |
Tue, 17 Apr 2012 19:35:17 +0200 |
Author: wachs
Date: 2012-04-17 19:35:17 +0200 (Tue, 17 Apr 2012)
New Revision: 20997
Modified:
gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
gnunet/src/ats/perf_ats_mlp.c
Log:
- hunting a bug
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-04-17 15:00:17 UTC
(rev 20996)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-04-17 17:35:17 UTC
(rev 20997)
@@ -877,13 +877,15 @@
mlp->lp_solved++;
mlp->lp_total_duration =+ duration.rel_value;
s_ctx->lp_duration = duration;
-
+GNUNET_assert (mlp->stats!= NULL);
GNUNET_STATISTICS_update (mlp->stats,"# LP problem solved", 1, GNUNET_NO);
GNUNET_STATISTICS_set (mlp->stats,"# LP execution time (ms)",
duration.rel_value, GNUNET_NO);
GNUNET_STATISTICS_set (mlp->stats,"# LP execution time average (ms)",
mlp->lp_total_duration / mlp->lp_solved, GNUNET_NO);
-
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "ats-mlp",
+ "%llu %llu \n", duration.rel_value, mlp->lp_total_duration /
mlp->lp_solved);
/* Analyze problem status */
res = glp_get_status (mlp->prob);
switch (res) {
@@ -960,7 +962,7 @@
GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time (ms)",
duration.rel_value, GNUNET_NO);
GNUNET_STATISTICS_set (mlp->stats,"# MLP execution time average (ms)",
mlp->mlp_total_duration / mlp->mlp_solved,
GNUNET_NO);
-
+GNUNET_break(0);
/* Analyze problem status */
res = glp_mip_status(mlp->prob);
switch (res) {
@@ -1027,7 +1029,7 @@
res = mlp_solve_lp_problem (mlp, &s_ctx);
if (res != GNUNET_OK)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "LP Problem solving failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "LP Problem solving failed\n");
return GNUNET_SYSERR;
}
#if WRITE_MLP
@@ -1041,7 +1043,7 @@
res = mlp_solve_mlp_problem (mlp, &s_ctx);
if (res != GNUNET_OK)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MLP Problem solving failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MLP Problem solving failed\n");
return GNUNET_SYSERR;
}
#if WRITE_MLP
@@ -1119,7 +1121,13 @@
char * quota_in_str;
/* Init GLPK environment */
- GNUNET_assert (glp_init_env() == 0);
+ int res = 0;
+ if (0 != (res = glp_init_env()))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not init GLPK %u\n", res);
+ GNUNET_free(mlp);
+ return NULL;
+ }
/* Create initial MLP problem */
mlp->prob = glp_create_prob();
Modified: gnunet/src/ats/perf_ats_mlp.c
===================================================================
--- gnunet/src/ats/perf_ats_mlp.c 2012-04-17 15:00:17 UTC (rev 20996)
+++ gnunet/src/ats/perf_ats_mlp.c 2012-04-17 17:35:17 UTC (rev 20997)
@@ -84,16 +84,24 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
unsigned int ca;
- for (ca=0; ca < (peers * addresses); ca++)
+ if (NULL != a)
{
- GNUNET_free (a[ca].plugin);
- GNUNET_free (a[ca].ats);
+ for (ca=0; ca < (peers * addresses); ca++)
+ {
+ GNUNET_free (a[ca].plugin);
+ GNUNET_free (a[ca].ats);
+ }
}
- GNUNET_CONTAINER_multihashmap_destroy(amap);
- GNUNET_free (a);
- GNUNET_free (p);
- GNUNET_STATISTICS_destroy(stats,GNUNET_NO);
+ if (NULL != mlp)
+ GAS_mlp_done (mlp);
+ if (NULL != amap)
+ GNUNET_CONTAINER_multihashmap_destroy(amap);
+ GNUNET_free_non_null (a);
+ GNUNET_free_non_null (p);
+ if (stats != NULL)
+ GNUNET_STATISTICS_destroy (stats,GNUNET_NO);
+
if (NULL != stats_proc)
{
if (0 != GNUNET_OS_process_kill (stats_proc, SIGTERM))
@@ -103,13 +111,13 @@
GNUNET_OS_process_close (stats_proc);
stats_proc = NULL;
}
- ret = 0;
}
-int stat_it (void *cls, const char *subsystem,
+int stat_lp_it (void *cls, const char *subsystem,
const char *name, uint64_t value,
int is_persistent)
{
+ GNUNET_break (0);
static int calls;
static long long unsigned lp_time;
static long long unsigned mlp_time;
@@ -119,6 +127,7 @@
if (0 == strcmp (name, "# MLP execution time (ms)"))
mlp_time = value;
+ GNUNET_break (0);
calls ++;
if (2 == calls)
@@ -131,31 +140,33 @@
return GNUNET_OK;
}
-static void
-check (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
+int stat_ready_it (void *cls, const char *subsystem,
+ const char *name, uint64_t value,
+ int is_persistent)
{
-#if !HAVE_LIBGLPK
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GLPK not installed!");
- ret = 1;
- return;
-#endif
unsigned int c = 0;
unsigned int c2 = 0;
unsigned int ca = 0;
+ struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- stats_proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-service-statistics",
- "gnunet-service-statistics", NULL);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Statistics service ready\n");
- if (NULL == stats_proc)
+ GNUNET_STATISTICS_watch (stats, "ats", "# LP execution time (ms)",
&stat_lp_it, NULL);
+ GNUNET_STATISTICS_watch (stats, "ats", "# MLP execution time (ms)",
&stat_lp_it, NULL);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting up %u peers with %u addresses
per peer\n", peers, addresses);
+
+ mlp = GAS_mlp_init (cfg, stats, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
+ if (NULL == mlp)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start statistics service
\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to init MLP\n");
ret = 1;
- return;
+ if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
+ GNUNET_SCHEDULER_cancel(shutdown_task);
+ shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ return GNUNET_NO;
}
- shutdown_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_HOURS,
&do_shutdown, NULL);
-
if (peers == 0)
peers = DEF_PEERS;
if (addresses == 0)
@@ -164,13 +175,8 @@
p = GNUNET_malloc (peers * sizeof (struct ATS_Peer));
a = GNUNET_malloc (peers * addresses * sizeof (struct ATS_Address));
- stats = GNUNET_STATISTICS_create("ats", cfg);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting up %u peers with %u addresses
per peer\n", peers, addresses);
-
amap = GNUNET_CONTAINER_multihashmap_create(addresses * peers);
- mlp = GAS_mlp_init (cfg, stats, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
mlp->auto_solve = GNUNET_NO;
for (c=0; c < peers; c++)
{
@@ -209,15 +215,44 @@
/* Solving the problem */
if (GNUNET_OK == GAS_mlp_solve_problem(mlp))
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Problem solved successfully \n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Problem solved successfully \n");
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Solving problem with %u peers and %u
addresses failed\n", peers, addresses);
- GAS_mlp_done (mlp);
+ GNUNET_log ( GNUNET_ERROR_TYPE_WARNING, "Waiting for statistics\n");
- GNUNET_STATISTICS_get (stats, "ats", "# LP execution time (ms)",
GNUNET_TIME_UNIT_MINUTES, NULL, &stat_it, NULL);
- GNUNET_STATISTICS_get (stats, "ats", "# MLP execution time (ms)",
GNUNET_TIME_UNIT_MINUTES, NULL, &stat_it, NULL);
+
+ return GNUNET_OK;
+}
+
+static void
+check (void *cls, char *const *args, const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+#if !HAVE_LIBGLPK
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "GLPK not installed!");
+ ret = 1;
return;
+#endif
+
+ stats_proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL,
"gnunet-service-statistics",
+ "gnunet-service-statistics", NULL);
+
+ if (NULL == stats_proc)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start statistics service
\n");
+ ret = 1;
+ if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
+ GNUNET_SCHEDULER_cancel(shutdown_task);
+ shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ return;
+ }
+
+ stats = GNUNET_STATISTICS_create("ats", cfg);
+
+ GNUNET_STATISTICS_watch (stats, "ats", "watch", &stat_ready_it, (void *)
cfg);
+ GNUNET_STATISTICS_set(stats, "watch", 1, GNUNET_NO);
+ return;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20997 - gnunet/src/ats,
gnunet <=