From afb916036c2cf3ac233bf01804092f7008ae0695 Mon Sep 17 00:00:00 2001 From: sneak Date: Mon, 28 Jul 2025 03:26:16 +0200 Subject: [PATCH] Fix handler processing time display for sub-millisecond values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add formatProcessingTime function to display microseconds for values < 1ms - Show 0 µs for times < 0.001ms, X.X µs for times < 0.01ms - Show X.XXX ms for times < 1ms, X.XX ms for times >= 1ms - Apply formatting to both average and min/max time displays --- internal/templates/status.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/templates/status.html b/internal/templates/status.html index 974b7d5..cddd975 100644 --- a/internal/templates/status.html +++ b/internal/templates/status.html @@ -202,6 +202,18 @@ return num.toLocaleString(); } + function formatProcessingTime(ms) { + if (ms < 0.001) { + return (ms * 1000).toFixed(0) + ' µs'; + } else if (ms < 0.01) { + return (ms * 1000).toFixed(1) + ' µs'; + } else if (ms < 1) { + return ms.toFixed(3) + ' ms'; + } else { + return ms.toFixed(2) + ' ms'; + } + } + function updatePrefixDistribution(elementId, distribution) { const container = document.getElementById(elementId); container.innerHTML = ''; @@ -252,11 +264,11 @@
Avg Time - ${handler.avg_process_time_ms.toFixed(2)} ms + ${formatProcessingTime(handler.avg_process_time_ms)}
Min/Max Time - ${handler.min_process_time_ms.toFixed(2)} / ${handler.max_process_time_ms.toFixed(2)} ms + ${formatProcessingTime(handler.min_process_time_ms)} / ${formatProcessingTime(handler.max_process_time_ms)}
`;