[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6486 - gnunet-gtk/src/plugins/stats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6486 - gnunet-gtk/src/plugins/stats |
Date: |
Thu, 28 Feb 2008 01:21:45 -0700 (MST) |
Author: grothoff
Date: 2008-02-28 01:21:45 -0700 (Thu, 28 Feb 2008)
New Revision: 6486
Modified:
gnunet-gtk/src/plugins/stats/functions.c
Log:
update to stats
Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c 2008-02-28 08:21:33 UTC (rev
6485)
+++ gnunet-gtk/src/plugins/stats/functions.c 2008-02-28 08:21:45 UTC (rev
6486)
@@ -76,7 +76,7 @@
}
#if FUNCTIONS_DEBUG
GNUNET_GE_LOG (ectx,
- GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER | GNUNET_GE_REQUEST,
+ GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
GNUNET_GE_USER | GNUNET_GE_BULK,
"Statistic not found: `%s'\n", optName);
#endif
return GNUNET_SYSERR;
@@ -358,71 +358,77 @@
return GNUNET_OK;
}
-
static int
-getEffectivenessStats (const void *closure, gfloat ** data)
+getTrustStats (const void *closure, gfloat ** data)
{
- static GNUNET_CronTime last;
- static double lastdata;
- static double lastavg;
- unsigned long long total;
- unsigned long long success;
- unsigned long long local;
- unsigned long long ltotal;
- unsigned long long lsuccess;
- unsigned long long llocal;
- GNUNET_CronTime now;
+ unsigned long long spent;
+ unsigned long long earned;
+ unsigned long long awarded;
+ unsigned long long lspent;
+ unsigned long long learned;
+ unsigned long long lawarded;
+ unsigned long long max;
- now = GNUNET_get_time ();
- if (now < last + 2 * GNUNET_CRON_MINUTES)
- {
- data[0][0] = lastdata;
- data[0][1] = lastavg;
- return GNUNET_OK;
- }
- last = now;
- if (GNUNET_OK != getStatValue (&total,
- <otal,
- NULL,
- "# gap requests forwarded (counting each
peer)",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&spent,
+ &lspent, NULL, "# trust spent", GNUNET_YES))
return GNUNET_SYSERR;
- if (GNUNET_OK != getStatValue (&success,
- &lsuccess,
- NULL, "# gap routing successes (total)",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&earned,
+ &learned,
+ NULL, "# trust earned", GNUNET_YES))
return GNUNET_SYSERR;
- if (GNUNET_OK != getStatValue (&local,
- &llocal,
- NULL,
- "# gap requests processed: local result",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&awarded,
+ &lawarded,
+ NULL, "# gap total trust awarded",
GNUNET_YES))
return GNUNET_SYSERR;
- total -= ltotal;
+ max = spent;
+ if (earned > max)
+ max = earned;
+ if (awarded > max)
+ max = awarded;
data[0][0] = 0.0;
- if (ltotal + total > 0)
+ if (max > 0)
{
- data[0][1] = lastavg =
- 1.0 * (success + lsuccess - local - llocal) / (total + ltotal);
+ data[0][0] = (1.0 * spent) / max;
+ data[0][1] = (1.0 * earned) / max;
+ data[0][2] = (1.0 * awarded) / max;
}
else
{
+ data[0][0] = 0.0;
data[0][1] = 0.0;
- return GNUNET_OK;
+ data[0][2] = 0.0;
}
- if (total == 0)
- return GNUNET_OK;
- success -= lsuccess;
- local -= llocal;
- if (success <= local)
- return GNUNET_OK;
- success -= local;
- lsuccess -= llocal;
- data[0][0] = lastdata = 1.0 * success / total;
return GNUNET_OK;
}
static int
+getEffectivenessStats (const void *closure, gfloat ** data)
+{
+ unsigned long long total; /* total number of queries passed on to remote */
+ unsigned long long success; /* responses forwarded (including local and
remote) */
+ unsigned long long ltotal;
+ unsigned long long lsuccess;
+
+ if (GNUNET_OK != getStatValue (&total,
+ <otal,
+ NULL,
+ "# gap requests total sent",
+ GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (GNUNET_OK != getStatValue (&success,
+ &lsuccess,
+ NULL, "# gap routes succeeded",
+ GNUNET_YES))
+ return GNUNET_SYSERR;
+ if (total > 0)
+ data[0][0] = 1.0 * success / total;
+ else
+ data[0][0] = 0.0;
+ return GNUNET_OK;
+}
+
+
+static int
statsProcessor (const char *optName, unsigned long long value, void *data)
{
/**
@@ -687,12 +693,21 @@
}
,
{
+ gettext_noop ("Trust"),
+ gettext_noop ("Spent (red) and Earned (green) Awarded (yellow)"),
+ &getTrustStats,
+ NULL,
+ 3,
+ GNUNET_NO,
+ }
+ ,
+ {
gettext_noop ("Routing Effectiveness"),
gettext_noop
- ("Current (red) and average (green) effectiveness (100% = perfect)"),
+ ("Average (red) effectiveness (100% = perfect)"),
&getEffectivenessStats,
NULL,
- 2,
+ 1,
GNUNET_NO,
}
,
@@ -728,7 +743,7 @@
GNUNET_cron_add_job (cron,
&updateStatValues, UPDATE_INTERVAL, UPDATE_INTERVAL,
NULL);
- GNUNET_cron_add_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_MINUTES,
+ GNUNET_cron_add_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_SECONDS,
5 * GNUNET_CRON_MINUTES, NULL);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6486 - gnunet-gtk/src/plugins/stats,
gnunet <=