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();