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)}
`;