[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21006 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21006 - gnunet/src/ats |
Date: |
Wed, 18 Apr 2012 12:27:15 +0200 |
Author: wachs
Date: 2012-04-18 12:27:15 +0200 (Wed, 18 Apr 2012)
New Revision: 21006
Modified:
gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
gnunet/src/ats/perf_ats_mlp.c
Log:
- fixes
Modified: gnunet/src/ats/gnunet-service-ats_addresses_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-04-18 09:55:09 UTC
(rev 21005)
+++ gnunet/src/ats/gnunet-service-ats_addresses_mlp.c 2012-04-18 10:27:15 UTC
(rev 21006)
@@ -883,9 +883,6 @@
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) {
@@ -1121,12 +1118,30 @@
char * quota_in_str;
/* Init GLPK environment */
- 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;
+ int res = glp_init_env();
+ switch (res) {
+ case 0:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GLPK: `%s'\n",
+ "initialization successful");
+ break;
+ case 1:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GLPK: `%s'\n",
+ "environment is already initialized");
+ break;
+ case 2:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not init GLPK: `%s'\n",
+ "initialization failed (insufficient memory)");
+ GNUNET_free(mlp);
+ return NULL;
+ break;
+ case 3:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not init GLPK: `%s'\n",
+ "initialization failed (unsupported programming model)");
+ GNUNET_free(mlp);
+ return NULL;
+ break;
+ default:
+ break;
}
/* Create initial MLP problem */
Modified: gnunet/src/ats/perf_ats_mlp.c
===================================================================
--- gnunet/src/ats/perf_ats_mlp.c 2012-04-18 09:55:09 UTC (rev 21005)
+++ gnunet/src/ats/perf_ats_mlp.c 2012-04-18 10:27:15 UTC (rev 21006)
@@ -40,6 +40,7 @@
static unsigned int peers;
static unsigned int addresses;
+static unsigned int numeric;
struct PeerContext *p;
struct ATS_Address *a;
@@ -84,6 +85,15 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
unsigned int ca;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown\n");
+
+ if (NULL != mlp)
+ {
+ GAS_mlp_done (mlp);
+ mlp = NULL;
+ }
+
if (NULL != a)
{
for (ca=0; ca < (peers * addresses); ca++)
@@ -92,8 +102,6 @@
GNUNET_free (a[ca].ats);
}
}
- if (NULL != mlp)
- GAS_mlp_done (mlp);
if (NULL != amap)
GNUNET_CONTAINER_multihashmap_destroy(amap);
@@ -117,22 +125,28 @@
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;
+ static long long unsigned lp_time_set;
+ static long long unsigned mlp_time_set;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received: `%s' : %u \n", name, value);
+
if (0 == strcmp (name, "# LP execution time (ms)"))
+ {
lp_time = value;
+ lp_time_set = GNUNET_YES;
+ }
if (0 == strcmp (name, "# MLP execution time (ms)"))
+ {
mlp_time = value;
+ mlp_time_set = GNUNET_YES;
+ }
- GNUNET_break (0);
- calls ++;
-
- if (2 == calls)
+ if ((GNUNET_YES == lp_time_set) && (GNUNET_YES == mlp_time_set))
{
- printf ("%u;%u;%llu;%llu\n",peers, addresses, lp_time, mlp_time);
+ if (GNUNET_YES == numeric)
+ printf ("%u;%u;%llu;%llu\n",peers, addresses, lp_time, mlp_time);
if (GNUNET_SCHEDULER_NO_TASK != shutdown_task)
GNUNET_SCHEDULER_cancel(shutdown_task);
shutdown_task = GNUNET_SCHEDULER_add_now(&do_shutdown, NULL);
@@ -149,7 +163,7 @@
unsigned int ca = 0;
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Statistics service ready\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Statistics service ready\n");
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);
@@ -215,7 +229,7 @@
/* Solving the problem */
if (GNUNET_OK == GAS_mlp_solve_problem(mlp))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Problem solved successfully \n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Problem solved successfully \n");
else
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Solving problem with %u peers and %u
addresses failed\n", peers, addresses);
@@ -267,6 +281,9 @@
{'p', "peers", NULL,
gettext_noop ("peers"), 1,
&GNUNET_GETOPT_set_uint, &peers},
+ {'n', "numeric", NULL,
+ gettext_noop ("numeric output only"), 0,
+ &GNUNET_GETOPT_set_one, &numeric},
GNUNET_GETOPT_OPTION_END
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21006 - gnunet/src/ats,
gnunet <=