2020-01-24 12:31:15 +00:00
|
|
|
#ifndef ODYSSEY_HGRAM_H
|
|
|
|
#define ODYSSEY_HGRAM_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Odyssey.
|
|
|
|
*
|
|
|
|
* Scalable PostgreSQL connection pooler.
|
2020-04-02 11:00:56 +00:00
|
|
|
*/
|
2020-01-24 12:31:15 +00:00
|
|
|
|
|
|
|
typedef struct od_hgram od_hgram_t;
|
|
|
|
typedef struct od_hgram od_hgram_frozen_t;
|
|
|
|
|
|
|
|
#define OD_HGRAM_DATA_POINTS 256
|
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
struct od_hgram
|
|
|
|
{
|
2020-01-24 12:31:15 +00:00
|
|
|
uint32_t data[OD_HGRAM_DATA_POINTS];
|
|
|
|
uint64_t estimated_size;
|
|
|
|
};
|
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
void
|
|
|
|
od_hgram_init(od_hgram_t *);
|
2020-01-24 12:31:15 +00:00
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
int
|
|
|
|
od_hgram_add_data_point(od_hgram_t *, uint64_t);
|
2020-01-24 12:31:15 +00:00
|
|
|
|
2020-03-18 05:12:53 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2020-04-02 11:00:56 +00:00
|
|
|
OD_HGRAM_FREEZ_RESET,
|
|
|
|
OD_HGRAM_FREEZ_NON_MUTABLE,
|
|
|
|
OD_HGRAM_FREEZ_REDUCE
|
2020-03-18 05:12:53 +00:00
|
|
|
} od_hgram_freeze_type_t;
|
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
void
|
|
|
|
od_hgram_freeze(od_hgram_t *, od_hgram_frozen_t *, od_hgram_freeze_type_t);
|
2020-01-24 12:31:15 +00:00
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
uint64_t
|
|
|
|
od_hgram_quantile(od_hgram_frozen_t *, double);
|
2020-01-24 12:31:15 +00:00
|
|
|
|
2020-04-02 11:00:56 +00:00
|
|
|
#endif // ODYSSEY_HGRAM_H
|