]> git.ipfire.org Git - fireperf.git/commitdiff
stats: Drop the unused stats dump function
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Sep 2024 14:42:16 +0000 (14:42 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Sep 2024 14:42:16 +0000 (14:42 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/ctx.c
src/ctx.h
src/stats.c
src/stats.h
src/tui.h

index 501d7502ccc68e1f1f89a96729157e9febefc89d..91b77be6345b0bc712ccdbdc8e09aef56d4aa049 100644 (file)
--- a/src/ctx.c
+++ b/src/ctx.c
@@ -419,21 +419,3 @@ struct fireperf_stats fireperf_ctx_get_stats(struct fireperf_ctx* ctx) {
 
        return stats;
 }
-
-int fireperf_ctx_dump_stats(struct fireperf_ctx* ctx) {
-       struct fireperf_stats stats = {};
-       int r;
-
-       // Fetch the current stats
-       stats = fireperf_ctx_get_stats(ctx);
-
-       // Dump the stats
-       r = fireperf_stats_dump(ctx, &ctx->stats, &stats);
-       if (r)
-               return r;
-
-       // Replace the stats for the next iteration
-       ctx->stats = stats;
-
-       return 0;
-}
index 2bc601ff32885556f589be6fb54de476d4e9be43..ed156f9eef1dc0f3a9d63a380490582a20e1abba 100644 (file)
--- a/src/ctx.h
+++ b/src/ctx.h
@@ -74,6 +74,4 @@ void fireperf_ctx_free(struct fireperf_ctx* ctx);
 struct fireperf_worker* fireperf_ctx_fetch_worker(struct fireperf_ctx* ctx);
 struct fireperf_stats fireperf_ctx_get_stats(struct fireperf_ctx* ctx);
 
-int fireperf_ctx_dump_stats(struct fireperf_ctx* ctx);
-
 #endif /* FIREPERF_CTX_H */
index 46a94f62499bb75b87378defb0d3e699d5a0e73c..1e95642ab8b86837a25d7c365828ddea7fc780aa 100644 (file)
@@ -42,55 +42,3 @@ struct fireperf_stats fireperf_stats_step(
 
        return stats;
 }
-
-int fireperf_stats_dump(struct fireperf_ctx* ctx,
-               struct fireperf_stats* old, struct fireperf_stats* new) {
-       // Compute the delta since the last dump
-       double delta = timespec_delta(&new->t, &old->t);
-
-       // Called too soon again?
-       if (delta < 0.1)
-               return 0;
-
-       // Compute the changes
-       const struct fireperf_stats stats = fireperf_stats_step(old, new);
-
-       // Format timestamp
-       const char* timestamp = format_timespec(&stats.t);
-
-       INFO(ctx, "--- %s -------------------------\n", timestamp);
-       INFO(ctx, "                      : %12s %12s\n", "RX", "TX");
-       INFO(ctx, "  %-20s: %25u\n", "Open Connection(s)", stats.open_connections);
-       INFO(ctx, "  %-20s: %23.2f/s\n", "New Connections", stats.connections / delta);
-
-       // Show current bandwidth
-       char* bps_received = format_size(stats.bytes_received * 8 / delta, FIREPERF_FORMAT_BITS);
-       char* bps_sent     = format_size(stats.bytes_sent * 8 / delta, FIREPERF_FORMAT_BITS);
-
-       if (bps_received || bps_sent) {
-               INFO(ctx, "  %-20s: %10s/s %10s/s\n", "Current Bandwidth", bps_received, bps_sent);
-
-               if (bps_received)
-                       free(bps_received);
-               if (bps_sent)
-                       free(bps_sent);
-       }
-
-       // Total bytes
-       char* total_bytes_received = format_size(stats.total_bytes_received, FIREPERF_FORMAT_BYTES);
-       char* total_bytes_sent     = format_size(stats.total_bytes_sent, FIREPERF_FORMAT_BYTES);
-
-       if (total_bytes_received || total_bytes_sent) {
-               INFO(ctx, "  %-20s: %12s %12s\n", "Total Bytes", total_bytes_received, total_bytes_sent);
-
-               if (total_bytes_received)
-                       free(total_bytes_received);
-               if (total_bytes_sent)
-                       free(total_bytes_sent);
-       }
-
-       // Empty line
-       INFO(ctx, "\n");
-
-       return 0;
-}
index d15f49c2eaee0cbaebb50eb5f64454b11b1b1fc7..577ac5287ac05c98029dffa9b51794ae5573aa04 100644 (file)
@@ -40,13 +40,7 @@ struct fireperf_stats {
        size_t total_bytes_sent;
 };
 
-// Forward declararion
-struct fireperf_ctx;
-
 struct fireperf_stats fireperf_stats_step(
        const struct fireperf_stats* old, const struct fireperf_stats* new);
 
-int fireperf_stats_dump(struct fireperf_ctx* ctx,
-       struct fireperf_stats* old, struct fireperf_stats* new);
-
 #endif /* FIREPERF_STATS_H */
index 6d29bc69e0ec8ca4969a447213472061fb8cf2c8..a210a43548c13444208710b716e41ba28f711b11 100644 (file)
--- a/src/tui.h
+++ b/src/tui.h
@@ -26,6 +26,9 @@ struct fireperf_tui;
 #include "ctx.h"
 #include "stats.h"
 
+// Forward declaration
+struct fireperf_ctx;
+
 int fireperf_tui_init(struct fireperf_tui** tui, struct fireperf_ctx* ctx);
 void fireperf_tui_finish(struct fireperf_tui* tui);