CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
t_digest.h File Reference

The declarations in this header file correspond to the definitions in t_digest.c. More...

#include <stdbool.h>
#include "configuration.h"
#include "cdi_logger_api.h"

Go to the source code of this file.

Macros

#define MAX_MERGED_CLUSTERS   (200)
 The maximum number of clusters allowed in a fully-merged digest.
 
#define MAX_UNMERGED_CLUSTERS   (50)
 The maximum number of clusters allowed in the incoming sample buffer (i.e unmerged clusters).
 
#define MAX_CLUSTERS   (MAX_MERGED_CLUSTERS + MAX_UNMERGED_CLUSTERS)
 The maximum number of clusters allowed in this algorithm. This determines how many cluster structrues are preallocated when the digest is created.
 
#define TDIGEST_LOG_THREAD(log_level, ...)
 Macro to allow t-Digest logging to be turned on or off via define DEBUG_T_DIGEST_LOGGING.
 

Typedefs

typedef struct TDigestTDigestHandle
 Opaque pointer for TDigest structure.
 

Functions

bool TDigestCreate (TDigestHandle *ret_td_handle_ptr)
 Function used to create a new t-digest.
 
void TDigestDestroy (TDigestHandle td_handle)
 Function used to free t-digest memory.
 
void TDigestClear (TDigestHandle td_handle)
 Function used to reset t-digest to begin collecting a new set of statistics. This function initializes all the TDigest data members.
 
void TDigestAddSample (TDigestHandle td_handle, uint32_t value)
 Function used to create a new t-digest.
 
bool TDigestGetPercentileValue (TDigestHandle td_handle, int percentile, uint32_t *value_at_percentile_ptr)
 Function used to get the value at a given percentile.
 
int TDigestGetCount (TDigestHandle td_handle)
 Function used to get the number of samples in the digest.
 

Detailed Description

The declarations in this header file correspond to the definitions in t_digest.c.

Function Documentation

◆ TDigestAddSample()

void TDigestAddSample ( TDigestHandle td_handle,
uint32_t value )

Function used to create a new t-digest.

Parameters
td_handleHandle for the TDigest object to use.
valueThe value of the new sample to add to the digest.

◆ TDigestClear()

void TDigestClear ( TDigestHandle td_handle)

Function used to reset t-digest to begin collecting a new set of statistics. This function initializes all the TDigest data members.

Parameters
td_handleHandle for the TDigest object to use.

◆ TDigestCreate()

bool TDigestCreate ( TDigestHandle * ret_td_handle_ptr)

Function used to create a new t-digest.

Parameters
ret_td_handle_ptrPointer for the handle for the new TDigest object.
Returns
True if successful; false if not.

◆ TDigestDestroy()

void TDigestDestroy ( TDigestHandle td_handle)

Function used to free t-digest memory.

Parameters
td_handleHandle for the TDigest object to use.

◆ TDigestGetCount()

int TDigestGetCount ( TDigestHandle td_handle)

Function used to get the number of samples in the digest.

Parameters
td_handleHandle for the TDigest object to use.
Returns
The number of samples in the digest.

◆ TDigestGetPercentileValue()

bool TDigestGetPercentileValue ( TDigestHandle td_handle,
int percentile,
uint32_t * value_at_percentile_ptr )

Function used to get the value at a given percentile.

Parameters
td_handleHandle for the TDigest object to use.
percentileThe desired percentile between 0 and 1, inclusive.
value_at_percentile_ptrPointer to the return value where resulting value of percentile search is stored.
Returns
True if successful; false if not.