summaryrefslogtreecommitdiffstats
path: root/web/api/queries/incremental_sum
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-06-09 04:52:57 +0000
commit00151562145df50cc65e9902d52d5fa77f89fe50 (patch)
tree2737716802f6725a5074d606ec8fe5422c58a83c /web/api/queries/incremental_sum
parentReleasing debian version 1.34.1-1. (diff)
downloadnetdata-00151562145df50cc65e9902d52d5fa77f89fe50.tar.xz
netdata-00151562145df50cc65e9902d52d5fa77f89fe50.zip
Merging upstream version 1.35.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/queries/incremental_sum')
-rw-r--r--web/api/queries/incremental_sum/incremental_sum.c23
-rw-r--r--web/api/queries/incremental_sum/incremental_sum.h2
2 files changed, 11 insertions, 14 deletions
diff --git a/web/api/queries/incremental_sum/incremental_sum.c b/web/api/queries/incremental_sum/incremental_sum.c
index 131d85d78..304d9aa74 100644
--- a/web/api/queries/incremental_sum/incremental_sum.c
+++ b/web/api/queries/incremental_sum/incremental_sum.c
@@ -11,9 +11,8 @@ struct grouping_incremental_sum {
size_t count;
};
-void *grouping_create_incremental_sum(RRDR *r) {
- (void)r;
- return callocz(1, sizeof(struct grouping_incremental_sum));
+void grouping_create_incremental_sum(RRDR *r) {
+ r->internal.grouping_data = callocz(1, sizeof(struct grouping_incremental_sum));
}
// resets when switches dimensions
@@ -31,17 +30,15 @@ void grouping_free_incremental_sum(RRDR *r) {
}
void grouping_add_incremental_sum(RRDR *r, calculated_number value) {
- if(!isnan(value)) {
- struct grouping_incremental_sum *g = (struct grouping_incremental_sum *)r->internal.grouping_data;
+ struct grouping_incremental_sum *g = (struct grouping_incremental_sum *)r->internal.grouping_data;
- if(unlikely(!g->count)) {
- g->first = value;
- g->count++;
- }
- else {
- g->last = value;
- g->count++;
- }
+ if(unlikely(!g->count)) {
+ g->first = value;
+ g->count++;
+ }
+ else {
+ g->last = value;
+ g->count++;
}
}
diff --git a/web/api/queries/incremental_sum/incremental_sum.h b/web/api/queries/incremental_sum/incremental_sum.h
index 990a2ac4a..5b55ad3c8 100644
--- a/web/api/queries/incremental_sum/incremental_sum.h
+++ b/web/api/queries/incremental_sum/incremental_sum.h
@@ -6,7 +6,7 @@
#include "../query.h"
#include "../rrdr.h"
-extern void *grouping_create_incremental_sum(RRDR *r);
+extern void grouping_create_incremental_sum(RRDR *r);
extern void grouping_reset_incremental_sum(RRDR *r);
extern void grouping_free_incremental_sum(RRDR *r);
extern void grouping_add_incremental_sum(RRDR *r, calculated_number value);