histogram.h
Go to the documentation of this file.
/*
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
#include "int_sizes.h"
struct histogram *histogram_create(double bucket_size);
void histogram_clear(struct histogram *h);
void histogram_delete(struct histogram *h);
int histogram_size(struct histogram *h);
double *histogram_buckets(struct histogram *h);
double histogram_bucket_size(struct histogram *h);
int histogram_insert(struct histogram *h, double value);
int histogram_count(struct histogram *h, double value);
void histogram_set_bucket(struct histogram *h, double value, int count);
void histogram_attach_data(struct histogram *h, double value, void *data);
void *histogram_get_data(struct histogram *h, double value);
int histogram_total_count(struct histogram *h);
double histogram_max_value(struct histogram *h);
double histogram_min_value(struct histogram *h);
double histogram_round_up(struct histogram *h, double test_value);
double histogram_mode(struct histogram *h);
#endif
histogram_delete
void histogram_delete(struct histogram *h)
Delete a histogram.
histogram_size
int histogram_size(struct histogram *h)
Count the number of active buckets.
histogram_max_value
double histogram_max_value(struct histogram *h)
Return the maximum value inserted in the histogram.
histogram_create
struct histogram * histogram_create(double bucket_size)
Create a new histogram.
histogram_buckets
double * histogram_buckets(struct histogram *h)
Returns an ordered array with the start values of the active buckets.
histogram_min_value
double histogram_min_value(struct histogram *h)
Return the minimum value inserted in the histogram.
histogram_clear
void histogram_clear(struct histogram *h)
Remove all entries from a histogram.
histogram_insert
int histogram_insert(struct histogram *h, double value)
Add value to histogram.
histogram_count
int histogram_count(struct histogram *h, double value)
Look up the count for the bucket of the given value.
histogram_total_count
int histogram_total_count(struct histogram *h)
Return the total number of samples in the histogram.
histogram_set_bucket
void histogram_set_bucket(struct histogram *h, double value, int count)
Manually set the count for a bucket.
histogram_attach_data
void histogram_attach_data(struct histogram *h, double value, void *data)
Attach custom data to bucket.
histogram_mode
double histogram_mode(struct histogram *h)
Return the mode of the histogram.
histogram_round_up
double histogram_round_up(struct histogram *h, double test_value)
Return the largest value of the bucket that test_value would faill in.
histogram_bucket_size
double histogram_bucket_size(struct histogram *h)
Returns the bucket size.
histogram_get_data
void * histogram_get_data(struct histogram *h, double value)
Retrieved custom data attached to the bucket.