socketstats: sort

This commit is contained in:
Cynthia Foxwell 2025-07-27 13:48:25 -06:00
parent f78e7d39ae
commit 9630f02275
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -227,7 +227,9 @@ socketstats.category = CATEGORY;
socketstats.helpText = "List the counts of socket events this session";
socketstats.callback = function () {
let out = "```c\n";
for (const [event, count] of Object.entries(hf.event_stats)) {
const events = Object.entries(hf.event_stats);
events.sort((a, b) => b[1] - a[1]);
for (const [event, count] of events) {
out += `"${event}": ${count}\n`;
}
out += "```";