diff --git a/apps/powermanager/boot.js b/apps/powermanager/boot.js index 0f26e18ab..c35ec1546 100644 --- a/apps/powermanager/boot.js +++ b/apps/powermanager/boot.js @@ -42,10 +42,10 @@ let logPower = (type, oldstate, state, app) => { - logFile.write("p," + type + ',' + (oldstate?1:0) + ',' + (state?1:0) + ',' + app + "\n"); + logFile.write(Date.now() + ",p," + type + ',' + (oldstate?1:0) + ',' + (state?1:0) + ',' + app + "\n"); }; let logDeferred = (type, duration, source) => { - logFile.write(type + ',' + duration + ',' + source.replace(/\n/g, " ").replace(/,/g,"") + "\n"); + logFile.write(Date.now() + "," + type + ',' + duration + ',' + source.replace(/\n/g, " ").replace(/,/g,"") + "\n"); }; let lastPowerOn = {}; @@ -162,4 +162,4 @@ if (!charging) chargeStart = undefined; }); } -})(); \ No newline at end of file +})(); diff --git a/apps/powermanager/interface.html b/apps/powermanager/interface.html index fac49694c..95fd3347b 100644 --- a/apps/powermanager/interface.html +++ b/apps/powermanager/interface.html @@ -1,6 +1,15 @@ + +
@@ -119,18 +128,21 @@ function viewDeferredTable(filename) {
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. -
- - - - - - - - - \n`; + + +
+ +
TimePercentageFunction
+ + + + + + + + \n`; htmlOverview += tableRows; - htmlOverview += `
TimePercentageFunction
`; + htmlOverview += ``; domContent.innerHTML = htmlOverview; domContent.querySelector("#back").addEventListener("click",event => { show(); @@ -234,24 +246,46 @@ function viewDetailsTable(filename) { Util.hideModal(); var htmlOverview = `

Detailed logging

- - This is a trace log of all logged power entries, first column denotes the type. p for power, i for interval and t for timeout. Power is logged with old state, new state and calling app if available. Functions are logged with execution duraion and source if available. - - - \n`; +
+ This is a trace log of all logged entries. Power is logged with type, state transition (old → new) and calling app if available. Functions are logged with execution duraion and source if available. +
+
+ +
+ + + + + + + + \n`; let rows = data.trim().split("\n"); + let firstTimestamp; for (var row of rows) { let cols = row.split(","); - htmlOverview += ` - - - - - - ` + let col = 0; + if (!firstTimestamp) firstTimestamp = cols[0]; + + if (cols[1] == "p"){ + cols[1] = "Power"; + htmlOverview += ` + + + + ` + } else { + htmlOverview += ` + + + + ` + } } - htmlOverview += `
TimeTypeInfo
${cols[0]}${cols[1]}${cols[2]}${cols[3]}${cols[4]}
${timeFormat(cols[col++]-firstTimestamp)}${cols[col++]}${cols[col++]}
${cols[col++]} → ${cols[col++]}
${cols[col++]}
${timeFormat(cols[col++]-firstTimestamp)}${cols[col++]=="t"?"Timeout":"Interval"}${new Number(cols[col++]).toFixed(0)}ms
${cols[col++]}
`; + htmlOverview += ``; + + domContent.innerHTML = htmlOverview; domContent.querySelector("#back").addEventListener("click",event => { show();