diff options
| author | chenzizhan <[email protected]> | 2024-07-15 16:12:36 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-07-15 16:12:36 +0800 |
| commit | 21e75c319bffa19b5f04af51edb74c69ec6e0a94 (patch) | |
| tree | f227227b682cc2e67556eda10ba2539f6692dc9c /src/metrics | |
| parent | e97ea6cc29970f1c31a1a9bb23d2507c88e31b37 (diff) | |
wip, add primary metric to spread sketchrefactor-heavykeeper-newkey-sswithprimarymetric
Diffstat (limited to 'src/metrics')
| -rw-r--r-- | src/metrics/hyperloglog.c (renamed from src/metrics/st_hyperloglog.c) | 18 | ||||
| -rw-r--r-- | src/metrics/hyperloglog.h (renamed from src/metrics/st_hyperloglog.h) | 5 | ||||
| -rw-r--r-- | src/metrics/metric.c | 2 | ||||
| -rw-r--r-- | src/metrics/python_api.c | 2 |
4 files changed, 5 insertions, 22 deletions
diff --git a/src/metrics/st_hyperloglog.c b/src/metrics/hyperloglog.c index be240f2..b13a2a2 100644 --- a/src/metrics/st_hyperloglog.c +++ b/src/metrics/hyperloglog.c @@ -3,7 +3,7 @@ * For our needs, we always use a dense representation and avoid the sparse/dense conversions. * */ -#include "st_hyperloglog.h" +#include "hyperloglog.h" #include "xxhash/xxhash.h" #include "crdt_utils.h" @@ -37,23 +37,7 @@ struct hyperloglog *hyperloglog_new(unsigned char precision) h->registers = ALLOC(uint32_t, words); return h; } -void hyperloglog_configure(struct hyperloglog *h, unsigned char precision, int time_window_seconds, const struct timeval now) -{ - if(h->cfg.precision != precision) - { - free(h->registers); - // Determine how many registers are needed - int reg = NUM_REG(precision); - - // Get the full words required - int words = INT_CEIL(reg, REG_PER_WORD); - // Allocate and zero out the registers - h->registers = ALLOC(uint32_t, words); - h->cfg.precision=precision; - } - return; -} void hyperloglog_free(struct hyperloglog *h) { free(h->registers); diff --git a/src/metrics/st_hyperloglog.h b/src/metrics/hyperloglog.h index 254ecb3..b0e6db5 100644 --- a/src/metrics/st_hyperloglog.h +++ b/src/metrics/hyperloglog.h @@ -30,13 +30,13 @@ extern "C" #define REGISTER_SIZE(precision) INT_WIDTH*INT_CEIL(NUM_REG(precision), REG_PER_WORD) -struct ST_HLL_configuration +struct HLL_configuration { unsigned char precision; }; struct hyperloglog { - struct ST_HLL_configuration cfg; + struct HLL_configuration cfg; uint32_t *registers; }; @@ -54,7 +54,6 @@ struct hyperloglog *hyperloglog_deserialize(const char *blob, size_t blob_sz); int hyperloglog_merge(struct hyperloglog *dest, const struct hyperloglog *src); void hyperloglog_merge_blob(struct hyperloglog *dest, const char *blob, size_t blob_sz); double hyperloglog_error_for_precision(unsigned char precision); -void hyperloglog_configure(struct hyperloglog *h, unsigned char precision, int time_window_seconds, const struct timeval now); #ifdef __cplusplus } #endif
\ No newline at end of file diff --git a/src/metrics/metric.c b/src/metrics/metric.c index 343b102..42f9c94 100644 --- a/src/metrics/metric.c +++ b/src/metrics/metric.c @@ -10,7 +10,7 @@ #include "metric.h" #include "hdr/hdr_histogram.h" #include "hdr/hdr_histogram_log.h" -#include "st_hyperloglog.h" +#include "hyperloglog.h" #include "metric_manifest.h" struct metric_counter_or_gauge { diff --git a/src/metrics/python_api.c b/src/metrics/python_api.c index 6f25fdf..3f52149 100644 --- a/src/metrics/python_api.c +++ b/src/metrics/python_api.c @@ -5,7 +5,7 @@ #include "histogram_encoder.h" #include "base64/b64.h" -#include "st_hyperloglog.h" +#include "hyperloglog.h" // user must free the buf after use void *fieldstat_histogram_base64_decode(char *buf) |
