@contrail/util 1.1.15-alpha-5 → 1.1.15-alpha-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,21 +16,25 @@ function demonstrateStartEndSpan() {
|
|
|
16
16
|
(0, performance_util_1.startSpan)('Complete Task');
|
|
17
17
|
(0, performance_util_1.startSpan)('Initialization');
|
|
18
18
|
const start2 = performance.now();
|
|
19
|
-
while (performance.now() < start2 + 50) {
|
|
19
|
+
while (performance.now() < start2 + 50) {
|
|
20
|
+
}
|
|
20
21
|
(0, performance_util_1.endSpan)('Initialization');
|
|
21
22
|
(0, performance_util_1.startSpan)('Main Processing');
|
|
22
23
|
(0, performance_util_1.startSpan)('Sub-task 1');
|
|
23
24
|
const start3 = performance.now();
|
|
24
|
-
while (performance.now() < start3 + 30) {
|
|
25
|
+
while (performance.now() < start3 + 30) {
|
|
26
|
+
}
|
|
25
27
|
(0, performance_util_1.endSpan)('Sub-task 1');
|
|
26
28
|
(0, performance_util_1.startSpan)('Sub-task 2');
|
|
27
29
|
const start4 = performance.now();
|
|
28
|
-
while (performance.now() < start4 + 40) {
|
|
30
|
+
while (performance.now() < start4 + 40) {
|
|
31
|
+
}
|
|
29
32
|
(0, performance_util_1.endSpan)('Sub-task 2');
|
|
30
33
|
(0, performance_util_1.endSpan)('Main Processing');
|
|
31
34
|
(0, performance_util_1.startSpan)('Cleanup');
|
|
32
35
|
const start5 = performance.now();
|
|
33
|
-
while (performance.now() < start5 + 20) {
|
|
36
|
+
while (performance.now() < start5 + 20) {
|
|
37
|
+
}
|
|
34
38
|
(0, performance_util_1.endSpan)('Cleanup');
|
|
35
39
|
(0, performance_util_1.endSpan)('Complete Task');
|
|
36
40
|
(0, performance_util_1.displayTimingTree)();
|
|
@@ -38,15 +42,18 @@ function demonstrateStartEndSpan() {
|
|
|
38
42
|
(0, performance_util_1.clearDefaultTimingProfile)();
|
|
39
43
|
(0, performance_util_1.startSpan)('Phase 1');
|
|
40
44
|
const start6 = performance.now();
|
|
41
|
-
while (performance.now() < start6 + 60) {
|
|
45
|
+
while (performance.now() < start6 + 60) {
|
|
46
|
+
}
|
|
42
47
|
(0, performance_util_1.endSpan)('Phase 1');
|
|
43
48
|
(0, performance_util_1.startSpan)('Phase 2');
|
|
44
49
|
const start7 = performance.now();
|
|
45
|
-
while (performance.now() < start7 + 80) {
|
|
50
|
+
while (performance.now() < start7 + 80) {
|
|
51
|
+
}
|
|
46
52
|
(0, performance_util_1.endSpan)('Phase 2');
|
|
47
53
|
(0, performance_util_1.startSpan)('Phase 3');
|
|
48
54
|
const start8 = performance.now();
|
|
49
|
-
while (performance.now() < start8 + 40) {
|
|
55
|
+
while (performance.now() < start8 + 40) {
|
|
56
|
+
}
|
|
50
57
|
(0, performance_util_1.endSpan)('Phase 3');
|
|
51
58
|
(0, performance_util_1.displayTimingTree)();
|
|
52
59
|
}
|
|
@@ -77,7 +77,7 @@ function withTimingSync(label, fn) {
|
|
|
77
77
|
function displayTimingTree(nodes = DEFAULT_TIMING_PROFILE.timingSpans, depth = 0) {
|
|
78
78
|
const lines = [];
|
|
79
79
|
const indent = ' '.repeat(depth);
|
|
80
|
-
const totalWidth =
|
|
80
|
+
const totalWidth = 120;
|
|
81
81
|
const timeWidth = 10;
|
|
82
82
|
nodes.forEach((node) => {
|
|
83
83
|
const timeStr = `${node.durationMs.toFixed(2)}ms`;
|
|
@@ -130,7 +130,7 @@ function endSpan(spanName) {
|
|
|
130
130
|
getTimingStack().pop();
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
|
-
const stackIndex = getTimingStack().findIndex(node => node === activeSpan.node);
|
|
133
|
+
const stackIndex = getTimingStack().findIndex((node) => node === activeSpan.node);
|
|
134
134
|
if (stackIndex !== -1) {
|
|
135
135
|
getTimingStack().splice(stackIndex, 1);
|
|
136
136
|
}
|