gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r10588 - in gnunet: . src src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r10588 - in gnunet: . src src/peerinfo
Date: Sat, 13 Mar 2010 12:17:04 +0100

Author: grothoff
Date: 2010-03-13 12:17:04 +0100 (Sat, 13 Mar 2010)
New Revision: 10588

Modified:
   gnunet/TODO
   gnunet/src/Makefile.am
   gnunet/src/peerinfo/Makefile.am
   gnunet/src/peerinfo/gnunet-service-peerinfo.c
Log:
more stats

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-03-13 10:49:36 UTC (rev 10587)
+++ gnunet/TODO 2010-03-13 11:17:04 UTC (rev 10588)
@@ -33,7 +33,6 @@
   - synchronous/asynchronous API (& implementation) is not nice;
     => provide notification-based API
   - does not seem to work with timeouts (especially if service is not running)
-  - add stats to peerinfo (# peers tracked)
   - add stats to fs service (# queries, # replies, # routed, # found, # 
pending)
   - add stats to dvstore (# bytes available, # bytes used, # PUTs, # GETs, # 
GETs satisfied)
 * ARM:

Modified: gnunet/src/Makefile.am
===================================================================
--- gnunet/src/Makefile.am      2010-03-13 10:49:36 UTC (rev 10587)
+++ gnunet/src/Makefile.am      2010-03-13 11:17:04 UTC (rev 10588)
@@ -14,10 +14,10 @@
 SUBDIRS = \
   include $(INTLEMU_SUBDIRS) \
   util \
+  statistics \
   arm \
   hello \
   peerinfo \
-  statistics \
   datacache \
   datastore \
   template \

Modified: gnunet/src/peerinfo/Makefile.am
===================================================================
--- gnunet/src/peerinfo/Makefile.am     2010-03-13 10:49:36 UTC (rev 10587)
+++ gnunet/src/peerinfo/Makefile.am     2010-03-13 11:17:04 UTC (rev 10588)
@@ -36,6 +36,7 @@
  gnunet-service-peerinfo.c         
 gnunet_service_peerinfo_LDADD = \
   $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/util/libgnunetutil.la 
 
 

Modified: gnunet/src/peerinfo/gnunet-service-peerinfo.c
===================================================================
--- gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-03-13 10:49:36 UTC 
(rev 10587)
+++ gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-03-13 11:17:04 UTC 
(rev 10588)
@@ -37,6 +37,7 @@
 #include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_service_lib.h"
+#include "gnunet_statistics_service.h"
 #include "peerinfo.h"
 
 /**
@@ -108,7 +109,12 @@
  */
 static char *trustDirectory;
 
+/**
+ * Handle for reporting statistics.
+ */
+static struct GNUNET_STATISTICS_Handle *stats;
 
+
 /**
  * Notify all clients in the notify list about the
  * given host entry changing.
@@ -251,6 +257,10 @@
   entry = lookup_host_entry (identity);
   if (entry != NULL)
     return;
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop ("# peers known"),
+                           1,
+                           GNUNET_NO);
   entry = GNUNET_malloc (sizeof (struct HostEntry));
   entry->identity = *identity;
   fn = get_trust_filename (identity);
@@ -763,6 +773,11 @@
 {
   GNUNET_SERVER_notification_context_destroy (notify_list);
   notify_list = NULL;
+  if (stats != NULL)
+    {
+      GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
+      stats = NULL;
+    }
 }
 
 
@@ -780,6 +795,7 @@
      struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
+  stats = GNUNET_STATISTICS_create (sched, "statistics", cfg);
   notify_list = GNUNET_SERVER_notification_context_create (server, 0);
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONFIGURATION_get_value_filename (cfg,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]