From: Christian Grothoff Date: Sun, 13 Feb 2011 09:42:03 +0000 (+0000) Subject: correct unit placement for GAUGER calls X-Git-Tag: initial-import-from-subversion-38251~19139 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=54440ebeed80d95185531c4725bd80e3bed161e5;p=oweals%2Fgnunet.git correct unit placement for GAUGER calls --- diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index c5f46b419..908657d6b 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h @@ -65,6 +65,7 @@ struct GNUNET_CONTAINER_BloomFilter; typedef int (*GNUNET_HashCodeIterator) (void *cls, GNUNET_HashCode * next); + /** * Load a bloom-filter from a file. * @@ -85,6 +86,7 @@ GNUNET_CONTAINER_bloomfilter_load (const int k); + /** * Create a bloom filter from raw bits. * @@ -108,6 +110,7 @@ GNUNET_CONTAINER_bloomfilter_init (const int k); + /** * Copy the raw data of this bloomfilter into * the given data array. @@ -121,6 +124,7 @@ int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct *bf, char *data, size_t size); + /** * Test if an element is in the filter. * @param e the element @@ -130,6 +134,7 @@ int GNUNET_CONTAINER_bloomfilter_get_raw_data (const struct int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter *bf, const GNUNET_HashCode * e); + /** * Add an element to the filter * @param bf the filter @@ -138,6 +143,7 @@ int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter *bf, const GNUNET_HashCode * e); + /** * Remove an element from the filter. * @param bf the filter @@ -146,6 +152,18 @@ void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter *bf, const GNUNET_HashCode * e); + +/** + * Free the space associcated with a filter + * in memory, flush to drive if needed (do not + * free the space on the drive) + * @param bf the filter + */ +struct GNUNET_CONTAINER_BloomFilter * +GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf); + + + /** * Free the space associcated with a filter * in memory, flush to drive if needed (do not @@ -942,7 +960,9 @@ GNUNET_CONTAINER_heap_iterate (const struct GNUNET_CONTAINER_Heap *heap, * */ void * -GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, uint32_t max); +GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, + uint32_t max); + /** * Perform a random walk of the tree. The walk is biased diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 306e88ed8..472c30d0d 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -133,7 +133,7 @@ end () fprintf (stderr, "\nThroughput was %llu kb/s\n", total_bytes * 1000 / 1024 / delta); - GNUNET_asprintf(&value_name, "reliable_kbs_%s", test_name); + GNUNET_asprintf(&value_name, "reliable-%s_kb/s", test_name); GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta)); GNUNET_free(value_name); ok = 0; diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index 2ca08c5b8..26d4cb035 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c @@ -186,7 +186,7 @@ end () "Transports disconnected, returning success!\n"); #endif delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value; - GNUNET_asprintf(&value_name, "unreliable_kbs_%s", test_name); + GNUNET_asprintf(&value_name, "unreliable-%s_kb/s", test_name); GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta)); GNUNET_free(value_name); fprintf (stderr, @@ -227,10 +227,10 @@ end_unreliably () fprintf (stderr, "\nThroughput was %llu kb/s\n", total_bytes * 1000 / 1024 / delta); - GNUNET_asprintf(&value_name, "unreliable_kbs_%s", test_name); + GNUNET_asprintf(&value_name, "unreliable-%s_kb/s", test_name); GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta)); GNUNET_free(value_name); - GNUNET_asprintf(&value_name, "unreliable_failed_%s", test_name); + GNUNET_asprintf(&value_name, "unreliable-%s_failed messages", test_name); GAUGER (value_name, (int)num_failed); GNUNET_free(value_name); GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Had %d failed messages!\n", num_failed); diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index d9cadb945..ea9c4e154 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c @@ -92,6 +92,21 @@ GNUNET_CONTAINER_bloomfilter_get_size (const struct GNUNET_CONTAINER_BloomFilter } +/** + * Copy an existing memory. Any association with a file + * on-disk will be lost in the process. + * @param bf the filter to copy + * @retun copy of the bf + */ +struct GNUNET_CONTAINER_BloomFilter * +GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf) +{ + return GNUNET_CONTAINER_bloomfilter_init (bf->bitArray, + bf->bitArraySize, + bf->addressesPerElement); +} + + /** * Sets a bit active in the bitArray. Increment bit-specific * usage counter on disk only if below 4bit max (==15).