From: Michael Tremer Date: Fri, 3 Apr 2026 14:14:38 +0000 (+0000) Subject: graphs: Split BYTES into two macros X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c7b1ed3d78d8078fc247b7e2f3d762602395e674;p=telemetry.git graphs: Split BYTES into two macros The preprocessor cannot split things as we would need although it sometimes works in a few places. Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graphs/graph.h b/src/daemon/graphs/graph.h index cd8d254..09c3a8e 100644 --- a/src/daemon/graphs/graph.h +++ b/src/daemon/graphs/graph.h @@ -75,7 +75,8 @@ typedef enum flags { #define SECONDS_HIGHRES "%%14.2lf%%ss" #define SECONDS "%%15.2lfs" -#define BYTES "%%12.2lf%%s%s", _("B") +#define BYTES "%%13.2lf %%s%s" +#define BYTES_UNIT _("B") // Temperatures #define KELVIN "%%14.2lf K" @@ -196,7 +197,7 @@ static inline int __DRAW(td_args* args, const char* what, const char* field, #define PRINT_EMPTY_LABEL(args) SCRIPT(args, "COMMENT: ") #define PRINT_NOTHING(args) SCRIPT(args, "COMMENT: ") #define PRINT(args, field, object, format, ...) \ - SCRIPT(args, "GPRINT:" FIELD ":" format, FIELD_AND_OBJECT(field, object) ##__VA_ARGS__) + SCRIPT(args, "GPRINT:" FIELD ":" format, FIELD_AND_OBJECT(field, object), ##__VA_ARGS__) #define PRINT_EOL(args) SCRIPT(args, "COMMENT:" EOL) /* @@ -413,7 +414,7 @@ static inline int __DRAW(td_args* args, const char* what, const char* field, #define __DRAW_IO_BYTES(args, object, bytes, color, label, ...) \ do { \ DRAW_AREA_WITH_LABEL(args, bytes, object, color, 0, label, __VA_ARGS__); \ - PRINT_CAMM(args, bytes, object, BYTES); \ + PRINT_CAMM(args, bytes, object, BYTES, BYTES_UNIT); \ } while (0) /* diff --git a/src/daemon/graphs/unbound-memory-usage.c b/src/daemon/graphs/unbound-memory-usage.c index 1a8b5c7..b1ef29a 100644 --- a/src/daemon/graphs/unbound-memory-usage.c +++ b/src/daemon/graphs/unbound-memory-usage.c @@ -47,23 +47,23 @@ static int unbound_memory_usage_render(td_ctx* ctx, td_graph* graph, // Draw the area outlines afterwards DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_respip", NULL, COLOR_DNS_RPZ, 0, _("Request Policy Zones")); - PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES); + PRINT_CAMM(args, "mem_mod_respip", NULL, BYTES, BYTES_UNIT); DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_validator", NULL, COLOR_DNS_VALIDATOR, STACKED, _("Validator")); - PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES); + PRINT_CAMM(args, "mem_mod_validator", NULL, BYTES, BYTES_UNIT); DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_mod_iterator", NULL, COLOR_DNS_ITERATOR, STACKED, _("Iterator")); - PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES); + PRINT_CAMM(args, "mem_mod_iterator", NULL, BYTES, BYTES_UNIT); DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_rrset", NULL, COLOR_DNS_RRSETS, STACKED, _("RRSet Objects")); - PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES); + PRINT_CAMM(args, "mem_cache_rrset", NULL, BYTES, BYTES_UNIT); DRAW_AREA_OUTLINE_WITH_LABEL(args, "mem_cache_message", NULL, COLOR_DNS_MSGS, STACKED, _("Message Objects")); - PRINT_CAMM(args, "mem_cache_message", NULL, BYTES); + PRINT_CAMM(args, "mem_cache_message", NULL, BYTES, BYTES_UNIT); PRINT_EMPTY_LINE(args);