MCPcopy Create free account
hub / github.com/HermanMartinus/bearblog / getCSSWidth

Function getCSSWidth

staticfiles/debug_toolbar/js/timer.js:16–32  ·  view source on GitHub ↗
(stat, endStat)

Source from the content-addressed store, hash-verified

14 }
15 }
16 function getCSSWidth(stat, endStat) {
17 let width = 0;
18 if (totalTime !== 0) {
19 width =
20 ((performance.timing[endStat] - performance.timing[stat]) /
21 totalTime) *
22 100.0;
23 }
24 const denominator = 100.0 - getLeft(stat);
25 if (denominator !== 0) {
26 // Calculate relative percent (same as sql panel logic)
27 width = (100.0 * width) / denominator;
28 } else {
29 width = 0;
30 }
31 return width < 1 ? "2px" : width + "%";
32 }
33 function addRow(tbody, stat, endStat) {
34 const row = document.createElement("tr");
35 if (endStat) {

Callers 1

addRowFunction · 0.70

Calls 1

getLeftFunction · 0.70

Tested by

no test coverage detected