]> git.ipfire.org Git - telemetry.git/commitdiff
graphs: Convert the other units as well
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Apr 2026 14:20:29 +0000 (14:20 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 3 Apr 2026 14:20:29 +0000 (14:20 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graphs/cpufreq.c
src/daemon/graphs/graph.h
src/daemon/graphs/hostapd-station-rate-info.c
src/daemon/graphs/legacy-hostile-drops.c
src/daemon/graphs/legacy-port-scans.c
src/daemon/graphs/legacy-suricata.c
src/daemon/graphs/unbound-cache-performance.c
src/daemon/graphs/unbound-queries.c

index 8180aa7f23e1acd29adaf61330bd3a2b6120de08..dd1a4a25bee290e2a52cfcbd1d7e2eadc5de2ac0 100644 (file)
@@ -59,7 +59,7 @@ static int cpufreq_render(td_ctx* ctx, td_graph* graph,
 
                // Draw the line
                DRAW_LINE_WITH_LABEL(args, 1, "freq_cur", object, COLOR_CPU(i), 0, _("CPU Core %ld"), i);
-               PRINT_CAMM(args, "freq_cur", object, HZ);
+               PRINT_CAMM(args, "freq_cur", object, HZ, HZ_UNIT);
 
                // Draw the minimum
                DRAW_LINE(args, 2, "freq_min", object, COLOR_MINIMUM, 0);
index 25aee73b59f9322db39c00efbcc573da2adb52cc..9f3b49f7ea3cf36ad52a0f98db7d34cec8defebe 100644 (file)
@@ -68,10 +68,14 @@ typedef enum flags {
 #define FLOAT                  "%%16.2lf"
 #define FLOAT_WITH_UNIT "%%12.2lf %3s"
 #define LARGE_FLOAT            "%%14.2lf %%s"
-#define BPS                            "%%11.2lf %%s%3s", _("bps")
-#define PPS                            "%%12.2lf %3s", _("pps")
-#define QPS                            "%%12.2lf %3s", _("qps")
-#define HZ                             "%%12.2lf %%s%2s", _("Hz")
+#define BPS                            "%%11.2lf %%s%3s"
+#define BPS_UNIT               _("bps")
+#define PPS                            "%%12.2lf %3s"
+#define PPS_UNIT               _("pps")
+#define QPS                            "%%12.2lf %3s"
+#define QPS_UNIT               _("qps")
+#define HZ                             "%%12.2lf %%s%2s"
+#define HZ_UNIT                        _("Hz")
 #define SECONDS_HIGHRES        "%%14.2lf%%ss"
 #define SECONDS         "%%15.2lfs"
 
@@ -454,7 +458,7 @@ static inline int __DRAW(td_args* args, const char* what, const char* field,
        do { \
                COMPUTE_BITS(args, FIELD_BITS(bytes), object, bytes); \
                DRAW_AREA_WITH_LABEL(args, FIELD_BITS(bytes), object, color, 0, label, __VA_ARGS__); \
-               PRINT_CAMM(args, bytes, object, BPS); \
+               PRINT_CAMM(args, bytes, object, BPS, BPS_UNIT); \
        } while (0)
 
 /*
@@ -475,7 +479,7 @@ static inline int __DRAW(td_args* args, const char* what, const char* field,
 #define __DRAW_PACKETS(args, object, packets, color, label, ...) \
        do { \
                DRAW_AREA_WITH_LABEL(args, packets, object, color, 0, label, __VA_ARGS__); \
-               PRINT_CAMM(args, packets, object, PPS); \
+               PRINT_CAMM(args, packets, object, PPS, PPS_UNIT); \
        } while (0)
 
 /*
index 83b792c2c8c0b90c17fc7f13940a8e3760574c54..918afadb2153a7418bcfd7897083326c95db5499 100644 (file)
@@ -43,11 +43,11 @@ static int hostapd_station_rate_info_render(td_ctx* ctx, td_graph* graph,
 
        // Receive Rate
        DRAW_LINE_WITH_LABEL(args, 2, "rx_rate", object, COLOR_RX, 0, _("Receive Rate"));
-       PRINT_CAMM(args, "rx_rate", object, BPS);
+       PRINT_CAMM(args, "rx_rate", object, BPS, BPS_UNIT);
 
        // Transmit Rate
        DRAW_LINE_WITH_LABEL(args, 2, "tx_rate", object, COLOR_TX, 0, _("Transmit Rate"));
-       PRINT_CAMM(args, "tx_rate", object, BPS);
+       PRINT_CAMM(args, "tx_rate", object, BPS, BPS_UNIT);
 
        return 0;
 }
index 9d21d5e23af76739f1a9212c14871a484d1399c3..5a064b524b27e8d4d3edeac97080e1f49ea7fe6c 100644 (file)
@@ -42,7 +42,7 @@ static int legacy_hostile_drops_render(td_ctx* ctx, td_graph* graph,
 
        DRAW_AREA_WITH_LABEL(args, "packets", "DROP_HOSTILE",
                        COLOR_DROP, 0, _("Dropped Packets"));
-       PRINT_CAMM(args, "packets", "DROP_HOSTILE", PPS);
+       PRINT_CAMM(args, "packets", "DROP_HOSTILE", PPS, PPS_UNIT);
 
        return 0;
 }
index 4cb8e12d2fa45d22607f68356891ccac6f66346a..9e04535f7ee850407006a6af0495061e919e3b46 100644 (file)
@@ -54,19 +54,19 @@ static int legacy_port_scans_render(td_ctx* ctx, td_graph* graph,
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "packets", "DROP_PSCAN_FRAG",
                        COLOR_IP_FRAG, 0, _("Fragmented Packets"));
-       PRINT_CAMM(args, "packets", "DROP_PSCAN_FRAG", PPS);
+       PRINT_CAMM(args, "packets", "DROP_PSCAN_FRAG", PPS, PPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "packets", "DROP_PSCAN_ICMP",
                        COLOR_ICMP, STACKED, _("ICMP"));
-       PRINT_CAMM(args, "packets", "DROP_PSCAN_ICMP", PPS);
+       PRINT_CAMM(args, "packets", "DROP_PSCAN_ICMP", PPS, PPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "packets", "DROP_PSCAN_UDP",
                        COLOR_UDP, STACKED, _("UDP"));
-       PRINT_CAMM(args, "packets", "DROP_PSCAN_UDP", PPS);
+       PRINT_CAMM(args, "packets", "DROP_PSCAN_UDP", PPS, PPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "packets", "DROP_PSCAN_TCP",
                        COLOR_TCP, STACKED, _("TCP"));
-       PRINT_CAMM(args, "packets", "DROP_PSCAN_TCP", PPS);
+       PRINT_CAMM(args, "packets", "DROP_PSCAN_TCP", PPS, PPS_UNIT);
 
        // Header
        PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
index 5ed12b1f88871e2099d8002815058aa8d92362e8..4fef694e655f668d33ee9cc3be8ae92c578b6805 100644 (file)
@@ -71,21 +71,21 @@ static int legacy_suricata_render(td_ctx* ctx, td_graph* graph,
        // Draw the area outlines afterwards
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "WHITELISTED", COLOR_WHITELISTED,
                0, _("Whitelisted"));
-       PRINT_CAMM(args, "bps", "WHITELISTED", BPS);
+       PRINT_CAMM(args, "bps", "WHITELISTED", BPS, BPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "BYPASSED", COLOR_OFFLOADED,
                STACKED, _("Offloaded"));
-       PRINT_CAMM(args, "bps", "BYPASSED", BPS);
+       PRINT_CAMM(args, "bps", "BYPASSED", BPS, BPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "bps", "SCANNED", COLOR_SCANNED,
                STACKED, _("Scanned"));
-       PRINT_CAMM(args, "bps", "SCANNED", BPS);
+       PRINT_CAMM(args, "bps", "SCANNED", BPS, BPS_UNIT);
 
        PRINT_EMPTY_LINE(args);
 
        // Show the total throughput
        PRINT_LABEL(args, _("Total"));
-       PRINT_CAMM(args, "total", NULL, BPS);
+       PRINT_CAMM(args, "total", NULL, BPS, BPS_UNIT);
 
        // Header
        PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
index b0bf55fcdc6f4a55e8a6277f83fd19b4746d8554..7a0fe76deb3bf21d5b6ed2e804c4aadf98c1d66f 100644 (file)
@@ -42,7 +42,7 @@ static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph,
 
        // Show the total queries
        PRINT_LABEL(args, _("Total"));
-       PRINT_CAMM(args, "queries", NULL, QPS);
+       PRINT_CAMM(args, "queries", NULL, QPS, QPS_UNIT);
 
        PRINT_EMPTY_LINE(args);
 
@@ -53,15 +53,15 @@ static int unbound_cache_performance_render(td_ctx* ctx, td_graph* graph,
        // Draw the area outlines afterwards
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachehits", NULL,
                COLOR_CACHE_HIT, 0, _("Cache Hits"));
-       PRINT_CAMM(args, "cachehits", NULL, QPS);
+       PRINT_CAMM(args, "cachehits", NULL, QPS, QPS_UNIT);
 
        DRAW_AREA_OUTLINE_WITH_LABEL(args, "cachemiss", NULL,
                COLOR_CACHE_MISS, STACKED, _("Cache Miss"));
-       PRINT_CAMM(args, "cachemiss", NULL, QPS);
+       PRINT_CAMM(args, "cachemiss", NULL, QPS, QPS_UNIT);
 
        DRAW_LINE_WITH_LABEL(args, 1, "prefetch", NULL,
                COLOR_CACHE_PREFETCH, 0, _("Prefetched Queries"));
-       PRINT_CAMM(args, "prefetch", NULL, QPS);
+       PRINT_CAMM(args, "prefetch", NULL, QPS, QPS_UNIT);
 
        return 0;
 }
index 70c1f815c7a5d7fa72a1b61451bc94a7034e20db..05a09ae08b0a20dcc8e4cc26b38b7bcca89dbfaf 100644 (file)
@@ -42,7 +42,7 @@ static int unbound_queries_render(td_ctx* ctx, td_graph* graph,
 
        // Draw the average
        DRAW_AREA_WITH_LABEL(args, "queries", NULL, COLOR_DEFAULT, 0, _("DNS Queries"));
-       PRINT_CAMM(args, "queries", NULL, QPS);
+       PRINT_CAMM(args, "queries", NULL, QPS, QPS_UNIT);
 
        return 0;
 }