summaryrefslogtreecommitdiffstats
path: root/web/api/queries/max
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-08-12 07:26:11 +0000
commit3c315f0fff93aa072472abc10815963ac0035268 (patch)
treea95f6a96e0e7bd139c010f8dc60b40e5b3062a99 /web/api/queries/max
parentAdding upstream version 1.35.1. (diff)
downloadnetdata-3c315f0fff93aa072472abc10815963ac0035268.tar.xz
netdata-3c315f0fff93aa072472abc10815963ac0035268.zip
Adding upstream version 1.36.0.upstream/1.36.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/queries/max')
-rw-r--r--web/api/queries/max/max.c16
-rw-r--r--web/api/queries/max/max.h6
2 files changed, 11 insertions, 11 deletions
diff --git a/web/api/queries/max/max.c b/web/api/queries/max/max.c
index b6e72331..73cf9fa6 100644
--- a/web/api/queries/max/max.c
+++ b/web/api/queries/max/max.c
@@ -6,12 +6,12 @@
// max
struct grouping_max {
- calculated_number max;
+ NETDATA_DOUBLE max;
size_t count;
};
-void grouping_create_max(RRDR *r) {
- r->internal.grouping_data = callocz(1, sizeof(struct grouping_max));
+void grouping_create_max(RRDR *r, const char *options __maybe_unused) {
+ r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_max));
}
// resets when switches dimensions
@@ -23,23 +23,23 @@ void grouping_reset_max(RRDR *r) {
}
void grouping_free_max(RRDR *r) {
- freez(r->internal.grouping_data);
+ onewayalloc_freez(r->internal.owa, r->internal.grouping_data);
r->internal.grouping_data = NULL;
}
-void grouping_add_max(RRDR *r, calculated_number value) {
+void grouping_add_max(RRDR *r, NETDATA_DOUBLE value) {
struct grouping_max *g = (struct grouping_max *)r->internal.grouping_data;
- if(!g->count || calculated_number_fabs(value) > calculated_number_fabs(g->max)) {
+ if(!g->count || fabsndd(value) > fabsndd(g->max)) {
g->max = value;
g->count++;
}
}
-calculated_number grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) {
+NETDATA_DOUBLE grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) {
struct grouping_max *g = (struct grouping_max *)r->internal.grouping_data;
- calculated_number value;
+ NETDATA_DOUBLE value;
if(unlikely(!g->count)) {
value = 0.0;
diff --git a/web/api/queries/max/max.h b/web/api/queries/max/max.h
index 7b606ce3..28913686 100644
--- a/web/api/queries/max/max.h
+++ b/web/api/queries/max/max.h
@@ -6,10 +6,10 @@
#include "../query.h"
#include "../rrdr.h"
-extern void grouping_create_max(RRDR *r);
+extern void grouping_create_max(RRDR *r, const char *options __maybe_unused);
extern void grouping_reset_max(RRDR *r);
extern void grouping_free_max(RRDR *r);
-extern void grouping_add_max(RRDR *r, calculated_number value);
-extern calculated_number grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr);
+extern void grouping_add_max(RRDR *r, NETDATA_DOUBLE value);
+extern NETDATA_DOUBLE grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr);
#endif //NETDATA_API_QUERY_MAX_H