cctools
histogram.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2016- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef HISTOGRAM_H
8 #define HISTOGRAM_H
9 
10 #include "int_sizes.h"
11 
65 struct histogram *histogram_create(double bucket_size);
66 
71 void histogram_clear(struct histogram *h);
72 
77 void histogram_delete(struct histogram *h);
78 
84 int histogram_size(struct histogram *h);
85 
87 double *histogram_buckets(struct histogram *h);
88 
90 double histogram_bucket_size(struct histogram *h);
91 
98 int histogram_insert(struct histogram *h, double value);
99 
106 int histogram_count(struct histogram *h, double value);
107 
114 void histogram_set_bucket(struct histogram *h, double value, int count);
115 
122 void histogram_attach_data(struct histogram *h, double value, void *data);
123 
130 void *histogram_get_data(struct histogram *h, double value);
131 
137 int histogram_total_count(struct histogram *h);
138 
144 double histogram_max_value(struct histogram *h);
145 
151 double histogram_min_value(struct histogram *h);
152 
153 
159 double histogram_round_up(struct histogram *h, double test_value);
160 
161 
167 double histogram_mode(struct histogram *h);
168 
169 #endif
double histogram_bucket_size(struct histogram *h)
Returns the bucket size.
void histogram_set_bucket(struct histogram *h, double value, int count)
Manually set the count for a bucket.
void histogram_attach_data(struct histogram *h, double value, void *data)
Attach custom data to bucket.
struct histogram * histogram_create(double bucket_size)
Create a new histogram.
int histogram_size(struct histogram *h)
Count the number of active buckets.
double histogram_max_value(struct histogram *h)
Return the maximum value inserted in the histogram.
void histogram_delete(struct histogram *h)
Delete a histogram.
int histogram_count(struct histogram *h, double value)
Look up the count for the bucket of the given value.
void histogram_clear(struct histogram *h)
Remove all entries from a histogram.
void * histogram_get_data(struct histogram *h, double value)
Retrieved custom data attached to the bucket.
double histogram_mode(struct histogram *h)
Return the mode of the histogram.
double histogram_round_up(struct histogram *h, double test_value)
Return the largest value of the bucket that test_value would faill in.
double * histogram_buckets(struct histogram *h)
Returns an ordered array with the start values of the active buckets.
int histogram_total_count(struct histogram *h)
Return the total number of samples in the histogram.
double histogram_min_value(struct histogram *h)
Return the minimum value inserted in the histogram.
int histogram_insert(struct histogram *h, double value)
Add value to histogram.