From: Michael Tremer Date: Wed, 29 Oct 2025 17:08:59 +0000 (+0000) Subject: graphs: memory: Convert bytes correctly based on 1024 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a77fe39563502d992fdd190087609f15b3fdc45f;p=telemetry.git graphs: memory: Convert bytes correctly based on 1024 Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph.c b/src/daemon/graph.c index 8d6f711..f93176d 100644 --- a/src/daemon/graph.c +++ b/src/daemon/graph.c @@ -304,6 +304,13 @@ int td_graph_render(td_graph* self, const char* object, if (r < 0) goto ERROR; + // Set base + if (self->impl->base) { + r = td_args_push(args, "--base=%d", self->impl->base); + if (r < 0) + goto ERROR; + } + // Set lower limit if (self->impl->lower_limit > -LONG_MAX) { r = td_args_push(args, "--lower-limit=%ld", self->impl->lower_limit); diff --git a/src/daemon/graph.h b/src/daemon/graph.h index 01d3a8b..739bc5e 100644 --- a/src/daemon/graph.h +++ b/src/daemon/graph.h @@ -41,6 +41,9 @@ typedef struct td_graph_impl { long lower_limit; long upper_limit; + // Base + int base; + // Available int (*available)(td_ctx* ctx, td_daemon* daemon); diff --git a/src/daemon/graphs/memory.c b/src/daemon/graphs/memory.c index c1883d0..0fa456b 100644 --- a/src/daemon/graphs/memory.c +++ b/src/daemon/graphs/memory.c @@ -107,6 +107,7 @@ const td_graph_impl memory_graph = { .render = memory_render, .title = memory_title, .vlabel = memory_vlabel, + .base = 1024, // Limits .lower_limit = 0,