summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cube.c9
-rw-r--r--src/fieldstat.c17
2 files changed, 10 insertions, 16 deletions
diff --git a/src/cube.c b/src/cube.c
index bafb170..f8a41d5 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -802,13 +802,18 @@ int cube_histogram_merge(struct cube *cube, int metric_id, const struct field *d
const struct metric_manifest *manifest = metric_manifest_manager_get_by_id(cube->manifest_manager, metric_id);
if (manifest == NULL || manifest->type != METRIC_TYPE_HISTOGRAM) {
- printf("invalid metric id\n");
return FS_ERR_INVALID_METRIC_ID;
}
+ // check if the parameters matches
+ if (src->lowest_discernible_value != manifest->parameters->hdr.lowest_trackable_value ||
+ src->highest_trackable_value != manifest->parameters->hdr.highest_trackable_value ||
+ src->significant_figures != manifest->parameters->hdr.significant_figures) {
+ return FS_ERR_INVALID_PARAM;
+ }
+
struct cell *cell_data = get_cell_in_cube_generic(cube, dimensions, n_dimensions);
if (cell_data == NULL) {
- printf("too many cells\n");
return FS_ERR_TOO_MANY_CELLS;
}
diff --git a/src/fieldstat.c b/src/fieldstat.c
index d8ecc2f..703861b 100644
--- a/src/fieldstat.c
+++ b/src/fieldstat.c
@@ -240,21 +240,10 @@ void fieldstat_calibrate(const struct fieldstat *master, struct fieldstat *repli
/* -------------------------------------------------------------------------- */
/* histogram fast batch transaction */
/* -------------------------------------------------------------------------- */
-struct histogram *fieldstat_histogram_fork(const struct fieldstat *instance, int cube_id, int metric_id) {
- const struct cube *cube = cube_manager_get_cube_by_id(instance->cube_manager, cube_id);
- if (cube == NULL) {
- return NULL;
- }
-
- const struct metric_manifest *manifest = cube_get_metric_manifest_by_id(cube, metric_id);
- if (manifest == NULL || manifest->type != METRIC_TYPE_HISTOGRAM) {
- return NULL;
- }
- const struct histogram_parameters *parameters = &(manifest->parameters->hdr);
-
+struct histogram *histogram_new(long long lowest_trackable_value, long long highest_trackable_value, int significant_figures) {
struct hdr_histogram* inner = NULL;
- int ret = hdr_init(parameters->lowest_trackable_value, parameters->highest_trackable_value, parameters->significant_figures, &inner);
- if (ret != 0) {
+ int ret = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &inner);
+ if (ret != 0) {
return NULL;
}