diff --git a/apps/powermanager/interface.html b/apps/powermanager/interface.html
index 7a00af993..fac49694c 100644
--- a/apps/powermanager/interface.html
+++ b/apps/powermanager/interface.html
@@ -108,7 +108,7 @@ function viewDeferredTable(filename) {
for (var i in rows) {
let c = rows[i];
tableRows += `
-
${(c.time/1000).toFixed(2)}s
+
${timeFormat(c.time)}
${(c.time/sum*100).toFixed(2)}%
${c.func}
`
}
@@ -118,7 +118,7 @@ function viewDeferredTable(filename) {
var htmlOverview = `
Deferred function calls
- This are functions used in timeouts and intervals and their accumulated execution times. Recorded in a time span of ${Math.round((duration)/1000)}s. Timeouts/intervals have run for ${Math.round(sum/1000)}s (${(sum/duration*100).toFixed(2)}%). Percentages are calculated from summarized timeout/interval running time.
+ This are functions used in timeouts and intervals and their accumulated execution times. Recorded in a time span of ${timeFormat(duration)}. Timeouts/intervals have run for ${timeFormat(sum)} (${(sum/duration*100).toFixed(2)}%). Percentages are calculated from summarized timeout/interval running time.
@@ -185,7 +185,7 @@ function viewHardwareTable(filename) {
for (var i in rows) {
let c = rows[i];
tableRows += `
-
${(c.time/1000).toFixed(2)}s
+
${timeFormat(c.time)}
${(c.time/duration*100).toFixed(2)}%
${c.func}
`
}
@@ -194,7 +194,7 @@ function viewHardwareTable(filename) {
var htmlOverview = `
Hardware power
- Recorded in a time span of ${Math.round(duration/1000)}s. Percentages are calculated from recording time.
+ Recorded in a time span of ${timeFormat(duration)}. Percentages are calculated from recording time.
@@ -263,6 +263,27 @@ function onInit() {
show();
}
+function timeFormat(time) {
+ let secs = time / 1000;
+
+ if (secs < 60)
+ return secs.toFixed(2) + "s";
+
+ let mins = secs / 60;
+ secs %= 60;
+ if (mins < 60)
+ return mins.toFixed(0) + "m" + secs.toFixed(0) + "s";
+
+ let hrs = mins / 60;
+ mins %= 60;
+ if (hrs < 24)
+ return hrs.toFixed(0) + "h" + mins.toFixed(0) + "m" + secs.toFixed(0) + "s";
+
+ let days = hrs / 24;
+ hrs %= 24;
+ return days.toFixed(0) + "d" + hrs.toFixed(0) + "h" + mins.toFixed(0) + "m" + secs.toFixed(0) + "s";
+}
+