[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4637 - gnunet-gtk/src/plugins/stats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4637 - gnunet-gtk/src/plugins/stats |
Date: |
Sun, 4 Mar 2007 18:51:43 -0700 (MST) |
Author: grothoff
Date: 2007-03-04 18:51:42 -0700 (Sun, 04 Mar 2007)
New Revision: 4637
Modified:
gnunet-gtk/src/plugins/stats/functions.c
Log:
handle restarts
Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c 2007-03-05 01:24:33 UTC (rev
4636)
+++ gnunet-gtk/src/plugins/stats/functions.c 2007-03-05 01:51:42 UTC (rev
4637)
@@ -52,7 +52,8 @@
static int getStatValue(long long * value,
long long * lvalue,
cron_t * dtime,
- const char * optName) {
+ const char * optName,
+ int monotone) {
unsigned int i;
*value = 0;
@@ -66,6 +67,9 @@
*lvalue = lastStatValues[i].lvalue;
if (dtime != NULL)
*dtime = lastStatValues[i].delta;
+ if ( (monotone == YES) &&
+ (*lvalue > *value) )
+ return SYSERR; /* gnunetd restart? */
return OK;
}
}
@@ -121,7 +125,8 @@
if (OK != getStatValue(&val,
NULL,
NULL,
- "# of connected peers"))
+ "# of connected peers",
+ NO))
return SYSERR;
data[0][0] = ((gfloat) val) / connectionGoal;
return OK;
@@ -137,22 +142,26 @@
if (OK != getStatValue(&valc,
NULL,
NULL,
- "% of allowed cpu load"))
+ "% of allowed cpu load",
+ NO))
return SYSERR;
if (OK != getStatValue(&vali,
NULL,
NULL,
- "% of allowed io load"))
+ "% of allowed io load",
+ NO))
return SYSERR;
if (OK != getStatValue(&valu,
NULL,
NULL,
- "% of allowed network load (up)"))
+ "% of allowed network load (up)",
+ NO))
return SYSERR;
if (OK != getStatValue(&vald,
NULL,
NULL,
- "% of allowed network load (down)"))
+ "% of allowed network load (down)",
+ NO))
return SYSERR;
data[0][0] = (gfloat) valc / 100.0;
data[0][1] = (gfloat) vali / 100.0;
@@ -169,14 +178,16 @@
if (OK != getStatValue(&allowed,
NULL,
NULL,
- "# bytes allowed in datastore"))
+ "# bytes allowed in datastore",
+ NO))
return SYSERR;
if (allowed == 0)
return SYSERR;
if (OK != getStatValue(&have,
NULL,
NULL,
- "# bytes in datastore"))
+ "# bytes in datastore",
+ NO))
return SYSERR;
data[0][0] = ((gfloat) have) / allowed;
return OK;
@@ -202,12 +213,14 @@
if (OK != getStatValue(&total,
<otal,
&dtime,
- "# bytes received"))
+ "# bytes received",
+ YES))
return SYSERR;
if (OK != getStatValue(&noise,
&lnoise,
NULL,
- "# bytes of noise received"))
+ "# bytes of noise received",
+ YES))
return SYSERR;
buffer = MALLOC(512);
SNPRINTF(buffer,
@@ -217,7 +230,8 @@
if (OK != getStatValue(&content,
&lcontent,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
content = 0;
lcontent = 0;
}
@@ -228,7 +242,8 @@
if (OK != getStatValue(&hellos,
&lhellos,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
hellos = 0;
lhellos = 0;
}
@@ -239,14 +254,16 @@
if (OK != getStatValue(&queries,
&lqueries,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
queries = 0;
lqueries = 0;
}
if (OK != getStatValue(&rlimit,
&lrlimit,
NULL,
- "# total advertised bytes per second received limit"))
{
+ "# total advertised bytes per second received limit",
+ NO)) {
rlimit = 0;
lrlimit = 0;
}
@@ -303,12 +320,14 @@
if (OK != getStatValue(&total,
<otal,
&dtime,
- "# bytes transmitted"))
+ "# bytes transmitted",
+ YES))
return SYSERR;
if (OK != getStatValue(&noise,
&lnoise,
NULL,
- "# bytes noise sent"))
+ "# bytes noise sent",
+ YES))
return SYSERR;
buffer = MALLOC(512);
SNPRINTF(buffer,
@@ -318,7 +337,8 @@
if (OK != getStatValue(&content,
&lcontent,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
content = 0;
lcontent = 0;
}
@@ -329,7 +349,8 @@
if (OK != getStatValue(&queries,
&lqueries,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
queries = 0;
lqueries = 0;
}
@@ -340,14 +361,16 @@
if (OK != getStatValue(&hellos,
&lhellos,
NULL,
- buffer)) {
+ buffer,
+ YES)) {
queries = 0;
lqueries = 0;
}
if (OK != getStatValue(&slimit,
&lslimit,
NULL,
- "# total allowed bytes per second transmission
limit")) {
+ "# total allowed bytes per second transmission limit",
+ NO)) {
slimit = 0;
lslimit = 0;
}
@@ -408,17 +431,20 @@
if (OK != getStatValue(&total,
<otal,
NULL,
- "# gap requests forwarded (counting each peer)"))
+ "# gap requests forwarded (counting each peer)",
+ YES))
return SYSERR;
if (OK != getStatValue(&success,
&lsuccess,
NULL,
- "# gap routing successes (total)"))
+ "# gap routing successes (total)",
+ YES))
return SYSERR;
if (OK != getStatValue(&local,
&llocal,
NULL,
- "# gap requests processed: local result"))
+ "# gap requests processed: local result",
+ YES))
return SYSERR;
total -= ltotal;
data[0][0] = 0.0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4637 - gnunet-gtk/src/plugins/stats,
gnunet <=