[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35032 - gnunet/src/rps
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35032 - gnunet/src/rps |
Date: |
Wed, 28 Jan 2015 17:56:47 +0100 |
Author: bartpolot
Date: 2015-01-28 17:56:47 +0100 (Wed, 28 Jan 2015)
New Revision: 35032
Modified:
gnunet/src/rps/gnunet-service-rps.c
gnunet/src/rps/gnunet-service-rps_sampler.c
gnunet/src/rps/gnunet-service-rps_sampler.h
Log:
- never resize to 0
Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-01-28 16:48:34 UTC (rev 35031)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-01-28 16:56:47 UTC (rev 35032)
@@ -790,11 +790,11 @@
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received a ns estimate - logest: %f, std_dev: %f (old_size: %u)\n",
- logestimate, std_dev, RPS_sampler_get_size());
+ logestimate, std_dev, RPS_sampler_get_size ());
//scale = .01;
estimate = GNUNET_NSE_log_estimate_to_n (logestimate);
// GNUNET_NSE_log_estimate_to_n (logestimate);
- estimate = pow (estimate, 1./3);
+ estimate = pow (estimate, 1.0 / 3);
// TODO add if std_dev is a number
// estimate += (std_dev * scale);
if (0 < ceil (estimate))
Modified: gnunet/src/rps/gnunet-service-rps_sampler.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps_sampler.c 2015-01-28 16:48:34 UTC (rev
35031)
+++ gnunet/src/rps/gnunet-service-rps_sampler.c 2015-01-28 16:56:47 UTC (rev
35032)
@@ -417,8 +417,8 @@
*
* @param new_size the new size of the sampler
*/
- void
-RPS_sampler_resize (unsigned int new_size)
+static void
+sampler_resize (unsigned int new_size)
{
unsigned int old_size;
uint32_t i;
@@ -481,6 +481,31 @@
/**
+ * Grow or shrink the size of the sampler.
+ *
+ * @param new_size the new size of the sampler
+ */
+void
+RPS_sampler_resize (unsigned int new_size)
+{
+ GNUNET_assert (0 < new_size);
+ sampler_resize (new_size);
+}
+
+
+/**
+ * Empty the sampler.
+ *
+ * @param new_size the new size of the sampler
+ */
+void
+RPS_sampler_empty ()
+{
+ sampler_resize (0);
+}
+
+
+/**
* Initialise a tuple of sampler elements.
*
* @param init_size the size the sampler is initialised with
Modified: gnunet/src/rps/gnunet-service-rps_sampler.h
===================================================================
--- gnunet/src/rps/gnunet-service-rps_sampler.h 2015-01-28 16:48:34 UTC (rev
35031)
+++ gnunet/src/rps/gnunet-service-rps_sampler.h 2015-01-28 16:56:47 UTC (rev
35032)
@@ -84,6 +84,15 @@
/**
+ * Empty the sampler.
+ *
+ * @param new_size the new size of the sampler
+ */
+void
+RPS_sampler_empty ();
+
+
+/**
* Initialise a tuple of samplers.
*
* @param init_size the size the sampler is initialised with
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35032 - gnunet/src/rps,
gnunet <=