[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12074 - gnunet/src/statistics
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12074 - gnunet/src/statistics |
Date: |
Thu, 1 Jul 2010 11:03:30 +0200 |
Author: grothoff
Date: 2010-07-01 11:03:30 +0200 (Thu, 01 Jul 2010)
New Revision: 12074
Modified:
gnunet/src/statistics/statistics_api.c
gnunet/src/statistics/test_statistics_api_loop.c
Log:
stats fixes
Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c 2010-07-01 08:43:07 UTC (rev
12073)
+++ gnunet/src/statistics/statistics_api.c 2010-07-01 09:03:30 UTC (rev
12074)
@@ -752,7 +752,8 @@
size_t slen;
size_t nlen;
size_t nsize;
-
+ int64_t delta;
+
GNUNET_assert (h != NULL);
GNUNET_assert (name != NULL);
if (GNUNET_YES != try_connect (h))
@@ -765,6 +766,54 @@
GNUNET_break (0);
return;
}
+ ai = h->action_head;
+ while (ai != NULL)
+ {
+ if ( (0 == strcmp (ai->subsystem, h->subsystem)) &&
+ (0 == strcmp (ai->name, name)) &&
+ ( (ai->type == ACTION_UPDATE) ||
+ (ai->type == ACTION_SET) ) )
+ {
+ if (ai->type == ACTION_SET)
+ {
+ if (type == ACTION_UPDATE)
+ {
+ delta = (int64_t) value;
+ if (delta > 0)
+ {
+ ai->value += delta;
+ }
+ else
+ {
+ if (ai->value < -delta)
+ ai->value = 0;
+ else
+ ai->value += delta;
+ }
+ }
+ else
+ {
+ ai->value = value;
+ }
+ }
+ else
+ {
+ if (type == ACTION_UPDATE)
+ {
+ delta = (int64_t) value;
+ ai->value += delta;
+ }
+ else
+ {
+ ai->value = value;
+ ai->type = type;
+ }
+ }
+ ai->timeout = GNUNET_TIME_relative_to_absolute
(SET_TRANSMIT_TIMEOUT);
+ return;
+ }
+ ai = ai->next;
+ }
ai = GNUNET_malloc (sizeof (struct GNUNET_STATISTICS_GetHandle));
ai->sh = h;
ai->subsystem = GNUNET_strdup (h->subsystem);
Modified: gnunet/src/statistics/test_statistics_api_loop.c
===================================================================
--- gnunet/src/statistics/test_statistics_api_loop.c 2010-07-01 08:43:07 UTC
(rev 12073)
+++ gnunet/src/statistics/test_statistics_api_loop.c 2010-07-01 09:03:30 UTC
(rev 12074)
@@ -79,7 +79,7 @@
i = 0;
GNUNET_break (NULL !=
GNUNET_STATISTICS_get (h, NULL, "test-0",
- GNUNET_TIME_UNIT_SECONDS, &next,
&check_1, cls));
+ GNUNET_TIME_UNIT_MINUTES, &next,
&check_1, cls));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12074 - gnunet/src/statistics,
gnunet <=