Get statistics values from within sampler
authorJulius Bünger <buenger@mytum.de>
Wed, 29 Aug 2018 10:30:13 +0000 (12:30 +0200)
committerJulius Bünger <buenger@mytum.de>
Wed, 29 Aug 2018 10:30:13 +0000 (12:30 +0200)
src/rps/gnunet-service-rps.c
src/rps/gnunet-service-rps_sampler.c
src/rps/rps.h

index 37b6a6fabc7c565c5ac135a01fef056787b36b6b..0b3befdcf1f654450b52a12762614642cd75ccfd 100644 (file)
@@ -61,7 +61,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
 /**
  * Handle to the statistics service.
  */
-static struct GNUNET_STATISTICS_Handle *stats;
+struct GNUNET_STATISTICS_Handle *stats;
 
 /**
  * Our own identity.
index 20b2d342001151a37b906b4d8160089074c86745..e07fe1f3c35d86db91be9f7314e403fa488019db 100644 (file)
@@ -23,6 +23,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
 #include "rps.h"
 
 #include "gnunet-service-rps_sampler.h"
@@ -636,7 +637,15 @@ sampler_mod_get_rand_peer (void *cls)
     // TODO add other reasons to wait here
   }
 
-  s_elem->last_client_request = GNUNET_TIME_absolute_get ();
+  GNUNET_STATISTICS_set (stats,
+                         "# client sampler element input",
+                         s_elem->num_peers,
+                         GNUNET_NO);
+  GNUNET_STATISTICS_set (stats,
+                         "# client sampler element change",
+                         s_elem->num_change,
+                         GNUNET_NO);
+
   RPS_sampler_elem_reinit (s_elem);
 
   GNUNET_CONTAINER_DLL_remove (gpc->req_handle->gpc_head,
index 6bf2273b4927df72ddf98188eeed6b9ed9974189..58ba790827057e8bf9a0dd2ad3a5ac3305b82d49 100644 (file)
@@ -216,6 +216,7 @@ struct GNUNET_RPS_CS_DEBUG_ViewReply
 };
   /* Followed by num_peers * GNUNET_PeerIdentity */
 
+GNUNET_NETWORK_STRUCT_END
 
 /***********************************************************************
  * Defines from old gnunet-service-rps_peers.h
@@ -312,4 +313,8 @@ typedef int
                   const struct GNUNET_PeerIdentity *peer);
 
 
-GNUNET_NETWORK_STRUCT_END
+/**
+ * Handle to the statistics service.
+ */
+extern struct GNUNET_STATISTICS_Handle *stats;
+