]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
add comments to header file
authorSvetlana Shmidt <sshmidt@google.com>
Tue, 28 Jul 2020 13:46:49 +0000 (18:46 +0500)
committerSvetlana Shmidt <sshmidt@google.com>
Tue, 28 Jul 2020 13:46:49 +0000 (18:46 +0500)
src/daemon/distribution.h

index 251df9f810cd650e86e94692167c70bd4ae3b946..7c887b09ed9e6215c58eda5952c54664b76820f6 100644 (file)
@@ -38,7 +38,7 @@ typedef struct distribution_s distribution_t;
  * [0; size) [size; 2 * size) ... [(num_buckets - 1) * size; infinity)
  * @param num_buckets - number of buckets. Should be greater than 0
  * @param size - size of each bucket. Should be greater than 0
- * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
+ * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
  */
 distribution_t* distribution_new_linear(size_t num_buckets, double size);
 
@@ -48,7 +48,7 @@ distribution_t* distribution_new_linear(size_t num_buckets, double size);
  * @param num_buckets - number of buckets. Should be greater than 0
  * @param initial_size - size of the first bucket. Should be greater than 0
  * @param factor - factor for buckets' upper bound. Should be greater than 1
- * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
+ * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
  */
 distribution_t* distribution_new_exponential(size_t num_buckets, double initial_size, double factor);
 
@@ -58,14 +58,28 @@ distribution_t* distribution_new_exponential(size_t num_buckets, double initial_
  * ... [custom_bucket_boundaries[array_size - 1], infinity)
  * @param array_size - size of array of bucket boundaries. Number of buckets is array_size + 1
  * @param custom_buckets_boundaries - array with bucket boundaries. Should be increasing and positive
- * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
+ * @return pointer to a new distribution or null pointer if parameters are wrong or memory allocation fails
  */
 distribution_t* distribution_new_custom(size_t array_size, double *custom_buckets_boundaries);
 
+/** add new value to a distribution **/
 void distribution_update(distribution_t *dist, double gauge);
+
+/**
+ * @param percent - should be in (0; 100] range
+ * @return - an approximation of percent percentile
+ * (upper bound of such bucket that all less or equal buckets contain more than percent percents of values)
+ * or NAN if parameters are wrong or distribution is empty
+ */
 double distribution_percentile(distribution_t *dist, double percent);
+
+/** @return - average of all values in distribution or NAN if distribution is empty */
 double distribution_average(distribution_t *dist);
+
+/** @return - pointer to the copy of distribution or null if memory allocation fails */
 distribution_t* distribution_clone(distribution_t *dist);
+
+/** destroy the distribution and free memory **/
 void distribution_destroy(distribution_t *d);
 
 #endif // COLLECTD_DISTRIBUTION_H