#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_dnsparser_lib.h"
+#include "gnunet_statistics_service.h"
#include "gnunet_namecache_service.h"
#include "gnunet_namecache_plugin.h"
#include "gnunet_signatures.h"
*/
static const struct GNUNET_CONFIGURATION_Handle *GSN_cfg;
+/**
+ * Handle to the statistics service
+ */
+static struct GNUNET_STATISTICS_Handle *statistics;
+
/**
* Database handle
*/
GSN_database));
GNUNET_free (db_lib_name);
db_lib_name = NULL;
+ if (NULL != statistics)
+ {
+ GNUNET_STATISTICS_destroy (statistics,
+ GNUNET_NO);
+ statistics = NULL;
+ }
}
GNUNET_memcpy (&r[1],
&block[1],
esize);
+ GNUNET_STATISTICS_update (statistics,
+ "blocks found in cache",
+ 1,
+ GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending NAMECACHE_LOOKUP_BLOCK_RESPONSE message with expiration time %s\n",
GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire)));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received NAMECACHE_LOOKUP_BLOCK message\n");
-
+ GNUNET_STATISTICS_update (statistics,
+ "blocks looked up",
+ 1,
+ GNUNET_NO);
lnc.request_id = ntohl (ln_msg->gns_header.r_id);
lnc.nc = nc;
lnc.status = GNUNET_OK;
size_t esize;
int res;
+ GNUNET_STATISTICS_update (statistics,
+ "blocks cached",
+ 1,
+ GNUNET_NO);
esize = ntohs (rp_msg->gns_header.header.size) - sizeof (struct BlockCacheMessage);
block = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_Block) + esize);
block->signature = rp_msg->signature;
NULL);
return;
}
+ statistics = GNUNET_STATISTICS_create ("namecache",
+ cfg);
/* Configuring server handles */
GNUNET_SCHEDULER_add_shutdown (&cleanup_task,