gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: add stats to namecache


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: add stats to namecache
Date: Thu, 10 Jan 2019 16:30:47 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 87a05357d add stats to namecache
87a05357d is described below

commit 87a05357dba158dd0ada1e37d5a53d390b2ce122
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Jan 10 16:30:45 2019 +0100

    add stats to namecache
---
 src/namecache/gnunet-service-namecache.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/namecache/gnunet-service-namecache.c 
b/src/namecache/gnunet-service-namecache.c
index c852aaacc..3b5119a8f 100644
--- a/src/namecache/gnunet-service-namecache.c
+++ b/src/namecache/gnunet-service-namecache.c
@@ -25,6 +25,7 @@
 #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"
@@ -58,6 +59,11 @@ struct NamecacheClient
 static const struct GNUNET_CONFIGURATION_Handle *GSN_cfg;
 
 /**
+ * Handle to the statistics service
+ */
+static struct GNUNET_STATISTICS_Handle *statistics;
+
+/**
  * Database handle
  */
 static struct GNUNET_NAMECACHE_PluginFunctions *GSN_database;
@@ -83,6 +89,12 @@ cleanup_task (void *cls)
                                      GSN_database));
   GNUNET_free (db_lib_name);
   db_lib_name = NULL;
+  if (NULL != statistics)
+  {
+    GNUNET_STATISTICS_destroy (statistics,
+                               GNUNET_NO);
+    statistics = NULL;
+  }
 }
 
 
@@ -194,6 +206,10 @@ handle_lookup_block_it (void *cls,
   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)));
@@ -220,7 +236,10 @@ handle_lookup_block (void *cls,
 
   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;
@@ -284,6 +303,10 @@ handle_block_cache (void *cls,
   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;
@@ -353,6 +376,8 @@ run (void *cls,
                              NULL);
     return;
   }
+  statistics = GNUNET_STATISTICS_create ("namecache",
+                                         cfg);
 
   /* Configuring server handles */
   GNUNET_SCHEDULER_add_shutdown (&cleanup_task,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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