format duration
This commit is contained in:
@@ -70,3 +70,16 @@ function formatDataVolume(amt, precision) {
|
|||||||
}
|
}
|
||||||
return amt + " B"
|
return amt + " B"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const second = 1000
|
||||||
|
const minute = second*60
|
||||||
|
const hour = minute*60
|
||||||
|
const day = hour*24
|
||||||
|
|
||||||
|
function formatDuration(ms) {
|
||||||
|
let res = ""
|
||||||
|
if (ms >= day) { res += Math.floor(ms/day) + "d " }
|
||||||
|
if (ms >= hour) { res += Math.floor((ms%day)/hour) + "h " }
|
||||||
|
if (ms >= minute) { res += Math.floor((ms%hour)/minute) + "m " }
|
||||||
|
return res + ((ms%minute)/second).toFixed(3) + "s"
|
||||||
|
}
|
||||||
|
@@ -187,8 +187,8 @@
|
|||||||
row.innerHTML = `\
|
row.innerHTML = `\
|
||||||
<td>${v.query_name}</td>
|
<td>${v.query_name}</td>
|
||||||
<td>${v.calls}</td>
|
<td>${v.calls}</td>
|
||||||
<td>${v.average_duration}ms</td>
|
<td>${formatDuration(v.average_duration)}</td>
|
||||||
<td>${v.total_duration}ms</td>
|
<td>${formatDuration(v.total_duration)}</td>
|
||||||
<td>${callers}</td>`
|
<td>${callers}</td>`
|
||||||
t.appendChild(row)
|
t.appendChild(row)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user