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
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
12#ifndef T_DIGEST_H__
13#define T_DIGEST_H__
14#include <stdbool.h>
15
16// The configuration.h file must be included first since it can have defines which affect subsequent files.
17#include "configuration.h"
18
19#include "cdi_logger_api.h"
20
21//*********************************************************************************************************************
22//***************************************** START OF DEFINITIONS AND TYPES ********************************************
23//*********************************************************************************************************************
25#define MAX_MERGED_CLUSTERS (200)
26
28#define MAX_UNMERGED_CLUSTERS (50)
29
32#define MAX_CLUSTERS (MAX_MERGED_CLUSTERS + MAX_UNMERGED_CLUSTERS)
33
35#ifdef DEBUG_T_DIGEST_LOGGING
36#define TDIGEST_LOG_THREAD(log_level, ...) CDI_LOG_THREAD(log_level, __VA_ARGS__);
37#else
38#define TDIGEST_LOG_THREAD(log_level, ...)
39#endif
40
42typedef struct TDigest* TDigestHandle;
43
44//*********************************************************************************************************************
45//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
46//*********************************************************************************************************************
47
55bool TDigestCreate(TDigestHandle* ret_td_handle_ptr);
56
62void TDigestDestroy(TDigestHandle td_handle);
63
70void TDigestClear(TDigestHandle td_handle);
71
78void TDigestAddSample(TDigestHandle td_handle, uint32_t value);
79
89bool TDigestGetPercentileValue(TDigestHandle td_handle, int percentile, uint32_t* value_at_percentile_ptr);
90
98int TDigestGetCount(TDigestHandle td_handle);
99#endif // T_DIGEST_H__
The declarations in this header file correspond to the definitions in logger.c.
This header file contains definitions used to define the build configuration of the CDI SDK's impleme...
The main structure of the t-digest.
Definition t_digest.c:70
void TDigestDestroy(TDigestHandle td_handle)
Function used to free t-digest memory.
Definition t_digest.c:524
void TDigestClear(TDigestHandle td_handle)
Function used to reset t-digest to begin collecting a new set of statistics. This function initialize...
Definition t_digest.c:531
struct TDigest * TDigestHandle
Opaque pointer for TDigest structure.
Definition t_digest.h:42
void TDigestAddSample(TDigestHandle td_handle, uint32_t value)
Function used to create a new t-digest.
Definition t_digest.c:544
int TDigestGetCount(TDigestHandle td_handle)
Function used to get the number of samples in the digest.
Definition t_digest.c:619
bool TDigestCreate(TDigestHandle *ret_td_handle_ptr)
Function used to create a new t-digest.
Definition t_digest.c:512
bool TDigestGetPercentileValue(TDigestHandle td_handle, int percentile, uint32_t *value_at_percentile_ptr)
Function used to get the value at a given percentile.
Definition t_digest.c:583