summaryrefslogtreecommitdiffstats
path: root/web/api/queries/median
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:39 +0000
commit89f3604407aff8f4cb2ed958252c61e23c767e24 (patch)
tree7fbf408102cab051557d38193524d8c6e991d070 /web/api/queries/median
parentAdding upstream version 1.34.1. (diff)
downloadnetdata-upstream/1.35.0.tar.xz
netdata-upstream/1.35.0.zip
Adding upstream version 1.35.0.upstream/1.35.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/queries/median')
-rw-r--r--web/api/queries/median/median.c10
-rw-r--r--web/api/queries/median/median.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/web/api/queries/median/median.c b/web/api/queries/median/median.c
index 31916c54..bffcee12 100644
--- a/web/api/queries/median/median.c
+++ b/web/api/queries/median/median.c
@@ -13,14 +13,14 @@ struct grouping_median {
LONG_DOUBLE series[];
};
-void *grouping_create_median(RRDR *r) {
+void grouping_create_median(RRDR *r) {
long entries = r->group;
if(entries < 0) entries = 0;
struct grouping_median *g = (struct grouping_median *)callocz(1, sizeof(struct grouping_median) + entries * sizeof(LONG_DOUBLE));
g->series_size = (size_t)entries;
- return g;
+ r->internal.grouping_data = g;
}
// resets when switches dimensions
@@ -41,10 +41,8 @@ void grouping_add_median(RRDR *r, calculated_number value) {
if(unlikely(g->next_pos >= g->series_size)) {
error("INTERNAL ERROR: median buffer overflow on chart '%s' - next_pos = %zu, series_size = %zu, r->group = %ld.", r->st->name, g->next_pos, g->series_size, r->group);
}
- else {
- if(calculated_number_isnumber(value))
- g->series[g->next_pos++] = (LONG_DOUBLE)value;
- }
+ else
+ g->series[g->next_pos++] = (LONG_DOUBLE)value;
}
calculated_number grouping_flush_median(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) {
diff --git a/web/api/queries/median/median.h b/web/api/queries/median/median.h
index dd2c1ffc..28d52b31 100644
--- a/web/api/queries/median/median.h
+++ b/web/api/queries/median/median.h
@@ -6,7 +6,7 @@
#include "../query.h"
#include "../rrdr.h"
-extern void *grouping_create_median(RRDR *r);
+extern void grouping_create_median(RRDR *r);
extern void grouping_reset_median(RRDR *r);
extern void grouping_free_median(RRDR *r);
extern void grouping_add_median(RRDR *r, calculated_number value);