Loading...
Searching...
No Matches
histogram_data.h File Reference

Generic histogram library. More...

Data Structures

struct  spdk_histogram_data
 

Macros

#define SPDK_HISTOGRAM_GRANULARITY_DEFAULT   7
 
#define SPDK_HISTOGRAM_GRANULARITY(h)   h->granularity
 
#define SPDK_HISTOGRAM_BUCKET_LSB(h)   (64 - SPDK_HISTOGRAM_GRANULARITY(h))
 
#define SPDK_HISTOGRAM_NUM_BUCKETS_PER_RANGE(h)   (1ULL << SPDK_HISTOGRAM_GRANULARITY(h))
 
#define SPDK_HISTOGRAM_BUCKET_MASK(h)   (SPDK_HISTOGRAM_NUM_BUCKETS_PER_RANGE(h) - 1)
 
#define SPDK_HISTOGRAM_NUM_BUCKET_RANGES(h)   (h->max_range - h->min_range + 1)
 
#define SPDK_HISTOGRAM_NUM_BUCKETS(h)
 

Typedefs

typedef void(* spdk_histogram_data_fn) (void *ctx, uint64_t start, uint64_t end, uint64_t count, uint64_t total, uint64_t so_far)
 

Functions

static void __spdk_histogram_increment (struct spdk_histogram_data *h, uint32_t range, uint32_t index)
 
static uint64_t __spdk_histogram_get_count (const struct spdk_histogram_data *h, uint32_t range, uint32_t index)
 
static uint64_t * __spdk_histogram_get_bucket (const struct spdk_histogram_data *h, uint32_t range, uint32_t index)
 
static void spdk_histogram_data_reset (struct spdk_histogram_data *histogram)
 
static uint32_t __spdk_histogram_data_get_bucket_range (struct spdk_histogram_data *h, uint64_t datapoint)
 
static uint32_t __spdk_histogram_data_get_bucket_index (struct spdk_histogram_data *h, uint64_t datapoint, uint32_t range)
 
static void spdk_histogram_data_tally (struct spdk_histogram_data *histogram, uint64_t datapoint)
 
static uint64_t __spdk_histogram_data_get_bucket_start (const struct spdk_histogram_data *h, uint32_t range, uint32_t index)
 
static void spdk_histogram_data_iterate (const struct spdk_histogram_data *histogram, spdk_histogram_data_fn fn, void *ctx)
 
static int spdk_histogram_data_merge (const struct spdk_histogram_data *dst, const struct spdk_histogram_data *src)
 
static struct spdk_histogram_dataspdk_histogram_data_alloc_sized_ext (uint32_t granularity, uint64_t min_val, uint64_t max_val)
 Allocate a histogram data structure with specified granularity.
 
static struct spdk_histogram_dataspdk_histogram_data_alloc_sized (uint32_t granularity)
 
static struct spdk_histogram_dataspdk_histogram_data_alloc (void)
 
static void spdk_histogram_data_free (struct spdk_histogram_data *h)
 

Detailed Description

Generic histogram library.

Macro Definition Documentation

◆ SPDK_HISTOGRAM_NUM_BUCKETS

#define SPDK_HISTOGRAM_NUM_BUCKETS ( h)
Value:
(SPDK_HISTOGRAM_NUM_BUCKETS_PER_RANGE(h) * \
SPDK_HISTOGRAM_NUM_BUCKET_RANGES(h))

Function Documentation

◆ spdk_histogram_data_alloc_sized_ext()

static struct spdk_histogram_data * spdk_histogram_data_alloc_sized_ext ( uint32_t granularity,
uint64_t min_val,
uint64_t max_val )
inlinestatic

Allocate a histogram data structure with specified granularity.

It tracks datapoints from min_val (inclusive) to max_val (exclusive).

Parameters
granularityGranularity of the histogram buckets. Each power-of-2 range is split into (1 << granularity) buckets.
min_valThe minimum value to be tracked, inclusive.
max_valThe maximum value to be tracked, exclusive.
Returns
A histogram data structure.