Skip to content

Commit dc127bb

Browse files
authored
Merge pull request #110 from savannahostrowski/tachyon-opcodes-savannah
CSS fixes for opcode-aware Tachyon - pythongh-138122
2 parents f368890 + 93f7abd commit dc127bb

File tree

3 files changed

+100
-24
lines changed

3 files changed

+100
-24
lines changed

Lib/profiling/sampling/_flamegraph_assets/flamegraph.css

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,84 @@ body.resizing-sidebar {
863863
text-align: center;
864864
}
865865

866+
/* --------------------------------------------------------------------------
867+
Tooltip Bytecode/Opcode Section
868+
-------------------------------------------------------------------------- */
869+
870+
.tooltip-opcodes {
871+
margin-top: 16px;
872+
padding-top: 12px;
873+
border-top: 1px solid var(--border);
874+
}
875+
876+
.tooltip-opcodes-title {
877+
color: var(--accent);
878+
font-size: 13px;
879+
margin-bottom: 8px;
880+
font-weight: 600;
881+
}
882+
883+
.tooltip-opcodes-list {
884+
background: var(--bg-tertiary);
885+
border: 1px solid var(--border);
886+
border-radius: 6px;
887+
padding: 10px;
888+
}
889+
890+
.tooltip-opcode-row {
891+
display: grid;
892+
grid-template-columns: 1fr 60px 60px;
893+
gap: 8px;
894+
align-items: center;
895+
padding: 3px 0;
896+
}
897+
898+
.tooltip-opcode-name {
899+
font-family: var(--font-mono);
900+
font-size: 11px;
901+
color: var(--text-primary);
902+
overflow: hidden;
903+
text-overflow: ellipsis;
904+
white-space: nowrap;
905+
}
906+
907+
.tooltip-opcode-name.specialized {
908+
color: var(--spec-high-text);
909+
}
910+
911+
.tooltip-opcode-base-hint {
912+
color: var(--text-muted);
913+
font-size: 11px;
914+
margin-left: 4px;
915+
}
916+
917+
.tooltip-opcode-badge {
918+
background: var(--spec-high);
919+
color: white;
920+
font-size: 9px;
921+
padding: 1px 4px;
922+
border-radius: 3px;
923+
margin-left: 4px;
924+
}
925+
926+
.tooltip-opcode-count {
927+
text-align: right;
928+
font-size: 11px;
929+
color: var(--text-secondary);
930+
}
931+
932+
.tooltip-opcode-bar {
933+
background: var(--bg-secondary);
934+
border-radius: 2px;
935+
height: 8px;
936+
overflow: hidden;
937+
}
938+
939+
.tooltip-opcode-bar-fill {
940+
background: linear-gradient(90deg, var(--python-blue), var(--python-blue-light));
941+
height: 100%;
942+
}
943+
866944
/* --------------------------------------------------------------------------
867945
Responsive (Flamegraph-specific)
868946
-------------------------------------------------------------------------- */

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -292,33 +292,31 @@ function createPythonTooltip(data) {
292292
const pct = ((count / totalOpcodeSamples) * 100).toFixed(1);
293293
const barWidth = (count / maxCount) * 100;
294294
const specializedBadge = opcodeInfo.isSpecialized
295-
? '<span style="background: #2e7d32; color: white; font-size: 9px; padding: 1px 4px; border-radius: 3px; margin-left: 4px;">SPECIALIZED</span>'
295+
? '<span class="tooltip-opcode-badge">SPECIALIZED</span>'
296296
: '';
297297
const baseOpHint = opcodeInfo.isSpecialized
298-
? `<span style="color: #888; font-size: 11px; margin-left: 4px;">(${opcodeInfo.baseOpname})</span>`
298+
? `<span class="tooltip-opcode-base-hint">(${opcodeInfo.baseOpname})</span>`
299299
: '';
300+
const nameClass = opcodeInfo.isSpecialized
301+
? 'tooltip-opcode-name specialized'
302+
: 'tooltip-opcode-name';
300303

301304
return `
302-
<div style="display: grid; grid-template-columns: 1fr 60px 60px; gap: 8px; align-items: center; padding: 3px 0;">
303-
<div style="font-family: monospace; font-size: 11px; color: ${opcodeInfo.isSpecialized ? '#2e7d32' : '#333'}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
305+
<div class="tooltip-opcode-row">
306+
<div class="${nameClass}">
304307
${opcodeInfo.opname}${baseOpHint}${specializedBadge}
305308
</div>
306-
<div style="text-align: right; font-size: 11px; color: #666;">${count.toLocaleString()}</div>
307-
<div style="background: #e9ecef; border-radius: 2px; height: 8px; overflow: hidden;">
308-
<div style="background: linear-gradient(90deg, #3776ab, #5a9bd5); height: 100%; width: ${barWidth}%;"></div>
309+
<div class="tooltip-opcode-count">${count.toLocaleString()}</div>
310+
<div class="tooltip-opcode-bar">
311+
<div class="tooltip-opcode-bar-fill" style="width: ${barWidth}%;"></div>
309312
</div>
310313
</div>`;
311314
}).join('');
312315

313316
opcodeSection = `
314-
<div style="margin-top: 16px; padding-top: 12px;
315-
border-top: 1px solid #e9ecef;">
316-
<div style="color: #3776ab; font-size: 13px;
317-
margin-bottom: 8px; font-weight: 600;">
318-
Bytecode Instructions:
319-
</div>
320-
<div style="background: #f8f9fa; border: 1px solid #e9ecef;
321-
border-radius: 6px; padding: 10px;">
317+
<div class="tooltip-opcodes">
318+
<div class="tooltip-opcodes-title">Bytecode Instructions:</div>
319+
<div class="tooltip-opcodes-list">
322320
${opcodeLines}
323321
</div>
324322
</div>`;

Lib/profiling/sampling/_shared_assets/base.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@
119119

120120
--header-gradient: linear-gradient(135deg, #21262d 0%, #30363d 100%);
121121

122-
/* Dark mode heat palette - dark blue to teal to yellow to orange (cold to hot) */
123-
--heat-1: #4a7ba7;
124-
--heat-2: #5a9fa8;
125-
--heat-3: #6ab5b5;
126-
--heat-4: #7ec488;
127-
--heat-5: #a0d878;
128-
--heat-6: #c4de6a;
129-
--heat-7: #f4d44d;
130-
--heat-8: #ff6b35;
122+
/* Dark mode heat palette - muted colors that provide sufficient contrast with light text */
123+
--heat-1: rgba(74, 123, 167, 0.35);
124+
--heat-2: rgba(90, 159, 168, 0.38);
125+
--heat-3: rgba(106, 181, 181, 0.40);
126+
--heat-4: rgba(126, 196, 136, 0.42);
127+
--heat-5: rgba(160, 216, 120, 0.45);
128+
--heat-6: rgba(196, 222, 106, 0.48);
129+
--heat-7: rgba(244, 212, 77, 0.50);
130+
--heat-8: rgba(255, 107, 53, 0.55);
131131

132132
/* Code view specific - dark mode */
133133
--code-bg: #0d1117;

0 commit comments

Comments
 (0)