Skip to content

Commit 9c9477a

Browse files
committed
Fix strings and calculation
1 parent d58bad9 commit 9c9477a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ function createPythonTooltip(data) {
317317
const selfSamples = d.data.self || 0;
318318
const selfMs = (selfSamples / 1000).toFixed(2);
319319
const percentage = ((d.data.value / data.value) * 100).toFixed(2);
320-
const relativePercentage = Math.max(100, ((d.data.value / (zoomedNodeValue ?? data.value)) * 100)).toFixed(2);
320+
const relativePercentage = zoomedNodeValue && zoomedNodeValue !== data.value ?
321+
(d.data.value / zoomedNodeValue * 100).toFixed(2) : undefined;
321322
const calls = d.data.calls || 0;
322323
const childCount = d.children ? d.children.length : 0;
323324
const source = d.data.source;
@@ -441,8 +442,8 @@ function createPythonTooltip(data) {
441442
<span class="tooltip-stat-label">Percentage:</span>
442443
<span class="tooltip-stat-value accent">${percentage}%</span>
443444
444-
${relativePercentage !== percentage && relativePercentage !== "100.00" ? `
445-
<span class="tooltip-stat-label">% of Selection:</span>
445+
${relativePercentage ? `
446+
<span class="tooltip-stat-label">Relative Percentage:</span>
446447
<span class="tooltip-stat-value accent">${relativePercentage}%</span>
447448
` : ''}
448449

0 commit comments

Comments
 (0)