[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11090 - in gnunet: . src/datacache
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11090 - in gnunet: . src/datacache |
Date: |
Wed, 28 Apr 2010 13:33:29 +0200 |
Author: grothoff
Date: 2010-04-28 13:33:29 +0200 (Wed, 28 Apr 2010)
New Revision: 11090
Modified:
gnunet/TODO
gnunet/src/datacache/Makefile.am
gnunet/src/datacache/datacache.c
Log:
stats for datacache
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-28 08:55:59 UTC (rev 11089)
+++ gnunet/TODO 2010-04-28 11:33:29 UTC (rev 11090)
@@ -169,7 +169,7 @@
- should use hash map to look up Neighbours (service AND plugins!)
* HOSTLIST:
- 'server' uses 'GNUNET_PEERINFO_iterate', should probably switch to
notification API
- (for more instant / up-to-date hostlists at lower cost)
+ (for more instant / up-to-date hostlists at lower cost) [done by MW?]
* DATASTORE (?):
- check for duplicates on insertion (currently, same content is frequently
stored again [seen with KBLOCKS and SBLOCKS]!)
@@ -185,9 +185,5 @@
- [./transport/plugin_transport_tcp.c:391]: (style) struct or union member
'Plugin::address_update_task' is never used (related to issue above)
* TRANSPORT:
- [./transport/gnunet-service-transport.c:173]: (style) struct or union
member 'TransportPlugin::rebuild' is never used (related to TCP not refreshing
external addresses?)
-* DATACACHE:
- - add stats (# bytes available, # bytes used, # PUTs, # GETs, # GETs
satisfied)
-* FS:
- - support inline data in directories for recursive file downloads
(fs_download)
* BLOCKS:
- testcase would be nice...
Modified: gnunet/src/datacache/Makefile.am
===================================================================
--- gnunet/src/datacache/Makefile.am 2010-04-28 08:55:59 UTC (rev 11089)
+++ gnunet/src/datacache/Makefile.am 2010-04-28 11:33:29 UTC (rev 11090)
@@ -18,6 +18,7 @@
libgnunetdatacache_la_SOURCES = \
datacache.c plugin_datacache.h
libgnunetdatacache_la_LIBADD = \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
libgnunetdatacache_la_LDFLAGS = \
Modified: gnunet/src/datacache/datacache.c
===================================================================
--- gnunet/src/datacache/datacache.c 2010-04-28 08:55:59 UTC (rev 11089)
+++ gnunet/src/datacache/datacache.c 2010-04-28 11:33:29 UTC (rev 11090)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2004, 2005, 2006, 2007, 2009 Christian Grothoff (and other
contributing authors)
+ (C) 2004, 2005, 2006, 2007, 2009, 2010 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_datacache_lib.h"
+#include "gnunet_statistics_service.h"
#include "plugin_datacache.h"
/**
@@ -45,6 +46,11 @@
const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
+ * Opaque handle for the statistics service.
+ */
+ struct GNUNET_STATISTICS_Handle *stats;
+
+ /**
* Configuration section to use.
*/
char *section;
@@ -100,6 +106,10 @@
GNUNET_assert (h->utilization >= size);
h->utilization -= size;
GNUNET_CONTAINER_bloomfilter_remove (h->filter, key);
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop ("# bytes stored"),
+ -size,
+ GNUNET_NO);
}
@@ -157,6 +167,9 @@
{
ret->filter = GNUNET_CONTAINER_bloomfilter_load (NULL, bf_size, 5); /*
approx. 3% false positives at max use */
}
+ ret->stats = GNUNET_STATISTICS_create (sched,
+ "datacache",
+ cfg);
ret->section = GNUNET_strdup (section);
ret->env.sched = sched;
ret->env.cfg = cfg;
@@ -204,6 +217,8 @@
h->bloom_name);
GNUNET_free (h->bloom_name);
}
+ GNUNET_STATISTICS_destroy (h->stats,
+ GNUNET_NO);
GNUNET_free (h);
}
@@ -237,6 +252,10 @@
discard_time);
if (used == 0)
return GNUNET_SYSERR;
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop ("# bytes stored"),
+ size,
+ GNUNET_NO);
GNUNET_CONTAINER_bloomfilter_add (h->filter, key);
while (h->utilization + used > h->env.quota)
GNUNET_assert (GNUNET_OK == h->api->del (h->api->cls));
@@ -263,9 +282,19 @@
GNUNET_DATACACHE_Iterator iter,
void *iter_cls)
{
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop ("# requests received"),
+ 1,
+ GNUNET_NO);
if (GNUNET_OK != GNUNET_CONTAINER_bloomfilter_test (h->filter,
key))
- return 0; /* can not be present */
+ {
+ GNUNET_STATISTICS_update (h->stats,
+ gettext_noop ("# requests filtered by bloom
filter"),
+ 1,
+ GNUNET_NO);
+ return 0; /* can not be present */
+ }
return h->api->get (h->api->cls,
key,
type,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11090 - in gnunet: . src/datacache,
gnunet <=