[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10582 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10582 - gnunet/src/datastore |
Date: |
Sat, 13 Mar 2010 11:00:28 +0100 |
Author: grothoff
Date: 2010-03-13 11:00:28 +0100 (Sat, 13 Mar 2010)
New Revision: 10582
Modified:
gnunet/src/datastore/Makefile.am
gnunet/src/datastore/gnunet-service-datastore.c
gnunet/src/datastore/plugin_datastore.h
gnunet/src/datastore/plugin_datastore_sqlite.c
Log:
more stats
Modified: gnunet/src/datastore/Makefile.am
===================================================================
--- gnunet/src/datastore/Makefile.am 2010-03-13 10:00:00 UTC (rev 10581)
+++ gnunet/src/datastore/Makefile.am 2010-03-13 10:00:28 UTC (rev 10582)
@@ -33,6 +33,7 @@
gnunet-service-datastore.c plugin_datastore.h
gnunet_service_datastore_LDADD = \
$(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c 2010-03-13 10:00:00 UTC
(rev 10581)
+++ gnunet/src/datastore/gnunet-service-datastore.c 2010-03-13 10:00:28 UTC
(rev 10582)
@@ -28,6 +28,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_protocols.h"
+#include "gnunet_statistics_service.h"
#include "plugin_datastore.h"
#include "datastore.h"
@@ -164,6 +165,12 @@
struct GNUNET_SCHEDULER_Handle *sched;
/**
+ * Handle for reporting statistics.
+ */
+static struct GNUNET_STATISTICS_Handle *stats;
+
+
+/**
* Function called once the transmit operation has
* either failed or succeeded.
*
@@ -313,6 +320,10 @@
"Deleting content that expired %llu ms ago\n",
(unsigned long long) (now.value - expiration.value));
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# bytes expired"),
+ size,
+ GNUNET_NO);
GNUNET_CONTAINER_bloomfilter_remove (filter,
key);
return GNUNET_NO; /* delete */
@@ -390,6 +401,10 @@
size + GNUNET_DATASTORE_ENTRY_OVERHEAD,
*need);
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# bytes purged (low-priority)"),
+ size,
+ GNUNET_NO);
GNUNET_CONTAINER_bloomfilter_remove (filter,
key);
return GNUNET_NO;
@@ -671,6 +686,10 @@
"Transmitting `%s' message\n",
"DATA");
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# results found"),
+ 1,
+ GNUNET_NO);
transmit (client, &dm->header, &get_next, next_cls, GNUNET_NO);
return GNUNET_OK;
}
@@ -897,6 +916,10 @@
&msg);
if (GNUNET_OK == ret)
{
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# bytes stored"),
+ size,
+ GNUNET_NO);
GNUNET_CONTAINER_bloomfilter_add (filter,
&dm->key);
#if DEBUG_DATASTORE
@@ -943,6 +966,10 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# GET requests received"),
+ 1,
+ GNUNET_NO);
GNUNET_SERVER_client_keep (client);
msg = (const struct GetMessage*) message;
if ( (size == sizeof(struct GetMessage)) &&
@@ -956,6 +983,10 @@
"GET",
GNUNET_h2s (&msg->key));
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# requests filtered by
bloomfilter"),
+ 1,
+ GNUNET_NO);
transmit_item (client,
NULL, NULL, 0, NULL, 0, 0, 0,
GNUNET_TIME_UNIT_ZERO_ABS, 0);
@@ -991,6 +1022,10 @@
"Processing `%s' request\n",
"UPDATE");
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# UPDATE requests received"),
+ 1,
+ GNUNET_NO);
msg = (const struct UpdateMessage*) message;
emsg = NULL;
ret = plugin->api->update (plugin->api->cls,
@@ -1020,6 +1055,10 @@
"Processing `%s' request\n",
"GET_RANDOM");
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# GET RANDOM requests received"),
+ 1,
+ GNUNET_NO);
GNUNET_SERVER_client_keep (client);
plugin->api->iter_migration_order (plugin->api->cls,
0,
@@ -1085,6 +1124,10 @@
(unsigned long long) uid,
"REMOVE");
#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# bytes removed (explicit request)"),
+ size,
+ GNUNET_NO);
GNUNET_CONTAINER_bloomfilter_remove (filter,
key);
plugin->api->next_request (next_cls, GNUNET_YES);
@@ -1119,6 +1162,10 @@
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# REMOVE requests received"),
+ 1,
+ GNUNET_NO);
rc = GNUNET_malloc (sizeof(struct RemoveContext));
GNUNET_SERVER_client_keep (client);
rc->client = client;
@@ -1256,6 +1303,11 @@
filter = NULL;
}
GNUNET_ARM_stop_services (cfg, tc->sched, "statistics", NULL);
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+ stats = NULL;
+ }
}
@@ -1368,6 +1420,7 @@
"DATASTORE");
return;
}
+ stats = GNUNET_STATISTICS_create (sched, "datastore", cfg);
cache_size = quota / 8; /* Or should we make this an option? */
bf_size = quota / 32; /* 8 bit per entry, 1 bit per 32 kb in DB */
fn = NULL;
@@ -1391,6 +1444,11 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to initialize bloomfilter.\n"));
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+ stats = NULL;
+ }
return;
}
GNUNET_ARM_start_services (cfg, sched, "statistics", NULL);
@@ -1400,6 +1458,11 @@
GNUNET_CONTAINER_bloomfilter_free (filter);
filter = NULL;
GNUNET_ARM_stop_services (cfg, sched, "statistics", NULL);
+ if (stats != NULL)
+ {
+ GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+ stats = NULL;
+ }
return;
}
GNUNET_SERVER_disconnect_notify (server, &cleanup_reservations, NULL);
Modified: gnunet/src/datastore/plugin_datastore.h
===================================================================
--- gnunet/src/datastore/plugin_datastore.h 2010-03-13 10:00:00 UTC (rev
10581)
+++ gnunet/src/datastore/plugin_datastore.h 2010-03-13 10:00:28 UTC (rev
10582)
@@ -31,8 +31,9 @@
#define PLUGIN_DATASTORE_H
#include "gnunet_configuration_lib.h"
+#include "gnunet_datastore_service.h"
+#include "gnunet_statistics_service.h"
#include "gnunet_scheduler_lib.h"
-#include "gnunet_datastore_service.h"
/**
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2010-03-13 10:00:00 UTC
(rev 10581)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2010-03-13 10:00:28 UTC
(rev 10582)
@@ -1605,10 +1605,10 @@
memset (&plugin, 0, sizeof(struct Plugin));
plugin.env = env;
plugin.statistics = GNUNET_STATISTICS_create (env->sched,
- "sqlite",
+ "datastore-sqlite",
env->cfg);
plugin.stat_get = GNUNET_STATISTICS_get (plugin.statistics,
- "sqlite",
+ "datastore-sqlite",
QUOTA_STAT_NAME,
GNUNET_TIME_UNIT_MINUTES,
&process_stat_done,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10582 - gnunet/src/datastore,
gnunet <=