From 5b344e9e377aab10f1bd6692117014812f61a41e Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 14 Feb 2024 02:15:11 +0100 Subject: [PATCH] Add some more temporary debug logging Signed-off-by: DL6ER --- src/api/history.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api/history.c b/src/api/history.c index 3c6a512f5..771c77f17 100644 --- a/src/api/history.c +++ b/src/api/history.c @@ -121,9 +121,19 @@ int api_history_clients(struct ftl_conn *api) temparray[2*clientID + 1] = client->count; } + // Print content of the array *before* sorting + log_info("Unsorted array:"); + for(int i = 0; i < counters->clients; i++) + log_info(" %d: %d", temparray[2*i + 0], temparray[2*i + 1]); + // Sort temporary array qsort(temparray, counters->clients, sizeof(int[2]), cmpdesc); + // Print content of the array *after* sorting + log_info("Sorted array:"); + for(int i = 0; i < counters->clients; i++) + log_info(" %d: %d", temparray[2*i + 0], temparray[2*i + 1]); + // Main return loop int others_total = 0; cJSON *history = JSON_NEW_ARRAY();