Skip to content

Commit 37289cb

Browse files
Show diff in ms
Since baseline and current self time are shown in ms, the diff should also be displayed in ms instead of samples.
1 parent 6e642e4 commit 37289cb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,10 @@ function createPythonTooltip(data) {
347347
if (d.data.diff !== undefined && d.data.baseline !== undefined) {
348348
const baselineSelf = (d.data.baseline / 1000).toFixed(2);
349349
const currentSelf = ((d.data.self_time || 0) / 1000).toFixed(2);
350-
const diffSamples = d.data.diff;
350+
const diffMs = (d.data.diff / 1000).toFixed(2);
351351
const diffPct = d.data.diff_pct;
352-
const sign = diffSamples >= 0 ? "+" : "";
353-
const diffClass = diffSamples > 0 ? "regression" : (diffSamples < 0 ? "improvement" : "neutral");
352+
const sign = d.data.diff >= 0 ? "+" : "";
353+
const diffClass = d.data.diff > 0 ? "regression" : (d.data.diff < 0 ? "improvement" : "neutral");
354354

355355
diffSection = `
356356
<div class="tooltip-diff">
@@ -365,7 +365,7 @@ function createPythonTooltip(data) {
365365
</div>
366366
<div class="tooltip-diff-row ${diffClass}">
367367
<span class="tooltip-stat-label">Difference:</span>
368-
<span class="tooltip-stat-value">${sign}${diffSamples.toFixed(1)} samples (${sign}${diffPct.toFixed(1)}%)</span>
368+
<span class="tooltip-stat-value">${sign}${diffMs} ms (${sign}${diffPct.toFixed(1)}%)</span>
369369
</div>
370370
</div>`;
371371
}

0 commit comments

Comments
 (0)