🌐 AI搜索 & 代理 主页
Skip to content

Commit 2eca80f

Browse files
gh-138122: Make Tachyon flamegraph and heatmap output more similar (#142590)
1 parent 0a62f82 commit 2eca80f

File tree

6 files changed

+67
-34
lines changed

6 files changed

+67
-34
lines changed

Lib/profiling/sampling/_flamegraph_assets/flamegraph.css

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,34 +329,44 @@ body.resizing-sidebar {
329329
gap: 8px;
330330
padding: 8px 10px;
331331
background: var(--bg-primary);
332-
border: 1px solid var(--border);
332+
border: 2px solid var(--border);
333333
border-radius: 8px;
334334
transition: all var(--transition-fast);
335335
animation: slideUp 0.4s ease-out backwards;
336-
animation-delay: calc(var(--i, 0) * 0.05s);
336+
animation-delay: calc(var(--i, 0) * 0.08s);
337337
overflow: hidden;
338+
position: relative;
338339
}
339340

340-
.summary-card:nth-child(1) { --i: 0; }
341-
.summary-card:nth-child(2) { --i: 1; }
342-
.summary-card:nth-child(3) { --i: 2; }
343-
.summary-card:nth-child(4) { --i: 3; }
341+
.summary-card:nth-child(1) { --i: 0; --card-color: 55, 118, 171; }
342+
.summary-card:nth-child(2) { --i: 1; --card-color: 40, 167, 69; }
343+
.summary-card:nth-child(3) { --i: 2; --card-color: 255, 193, 7; }
344+
.summary-card:nth-child(4) { --i: 3; --card-color: 111, 66, 193; }
344345

345346
.summary-card:hover {
346-
border-color: var(--accent);
347-
background: var(--accent-glow);
347+
border-color: rgba(var(--card-color), 0.6);
348+
background: linear-gradient(135deg, rgba(var(--card-color), 0.08) 0%, var(--bg-primary) 100%);
349+
transform: translateY(-2px);
350+
box-shadow: 0 4px 12px rgba(var(--card-color), 0.15);
348351
}
349352

350353
.summary-icon {
351-
font-size: 16px;
354+
font-size: 14px;
352355
width: 28px;
353356
height: 28px;
354357
display: flex;
355358
align-items: center;
356359
justify-content: center;
357-
background: var(--bg-tertiary);
360+
background: linear-gradient(135deg, rgba(var(--card-color), 0.15) 0%, rgba(var(--card-color), 0.05) 100%);
361+
border: 1px solid rgba(var(--card-color), 0.2);
358362
border-radius: 6px;
359363
flex-shrink: 0;
364+
transition: all var(--transition-fast);
365+
}
366+
367+
.summary-card:hover .summary-icon {
368+
transform: scale(1.05);
369+
background: linear-gradient(135deg, rgba(var(--card-color), 0.25) 0%, rgba(var(--card-color), 0.1) 100%);
360370
}
361371

362372
.summary-data {
@@ -368,8 +378,8 @@ body.resizing-sidebar {
368378
.summary-value {
369379
font-family: var(--font-mono);
370380
font-size: 13px;
371-
font-weight: 700;
372-
color: var(--accent);
381+
font-weight: 800;
382+
color: rgb(var(--card-color));
373383
line-height: 1.2;
374384
white-space: nowrap;
375385
overflow: hidden;

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,27 @@ function restoreUIState() {
187187
}
188188
}
189189

190+
// ============================================================================
191+
// Logo/Favicon Setup
192+
// ============================================================================
193+
194+
function setupLogos() {
195+
const logo = document.querySelector('.sidebar-logo-img img');
196+
if (!logo) return;
197+
198+
const navbarLogoContainer = document.getElementById('navbar-logo');
199+
if (navbarLogoContainer) {
200+
const navbarLogo = logo.cloneNode(true);
201+
navbarLogoContainer.appendChild(navbarLogo);
202+
}
203+
204+
const favicon = document.createElement('link');
205+
favicon.rel = 'icon';
206+
favicon.type = 'image/png';
207+
favicon.href = logo.src;
208+
document.head.appendChild(favicon);
209+
}
210+
190211
// ============================================================================
191212
// Status Bar
192213
// ============================================================================
@@ -198,6 +219,11 @@ function updateStatusBar(nodeData, rootValue) {
198219
const timeMs = (nodeData.value / 1000).toFixed(2);
199220
const percent = rootValue > 0 ? ((nodeData.value / rootValue) * 100).toFixed(1) : "0.0";
200221

222+
const brandEl = document.getElementById('status-brand');
223+
const taglineEl = document.getElementById('status-tagline');
224+
if (brandEl) brandEl.style.display = 'none';
225+
if (taglineEl) taglineEl.style.display = 'none';
226+
201227
const locationEl = document.getElementById('status-location');
202228
const funcItem = document.getElementById('status-func-item');
203229
const timeItem = document.getElementById('status-time-item');
@@ -230,6 +256,11 @@ function clearStatusBar() {
230256
const el = document.getElementById(id);
231257
if (el) el.style.display = 'none';
232258
});
259+
260+
const brandEl = document.getElementById('status-brand');
261+
const taglineEl = document.getElementById('status-tagline');
262+
if (brandEl) brandEl.style.display = 'flex';
263+
if (taglineEl) taglineEl.style.display = 'flex';
233264
}
234265

235266
// ============================================================================
@@ -1065,6 +1096,7 @@ function exportSVG() {
10651096
function initFlamegraph() {
10661097
ensureLibraryLoaded();
10671098
restoreUIState();
1099+
setupLogos();
10681100

10691101
let processedData = EMBEDDED_DATA;
10701102
if (EMBEDDED_DATA.strings) {

Lib/profiling/sampling/_flamegraph_assets/flamegraph_template.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Tachyon Profiler - Flamegraph</title>
6+
<title>Tachyon Profiler - Flamegraph Report</title>
77
<!-- INLINE_VENDOR_D3_JS -->
88
<!-- INLINE_VENDOR_FLAMEGRAPH_CSS -->
99
<!-- INLINE_VENDOR_FLAMEGRAPH_JS -->
@@ -15,9 +15,10 @@
1515
<!-- Top Bar -->
1616
<header class="top-bar">
1717
<div class="brand">
18+
<div class="brand-logo" id="navbar-logo"></div>
1819
<span class="brand-text">Tachyon</span>
1920
<span class="brand-divider"></span>
20-
<span class="brand-subtitle">Profiler</span>
21+
<span class="brand-subtitle">Flamegraph Report</span>
2122
</div>
2223
<div class="search-wrapper">
2324
<input
@@ -290,6 +291,12 @@ <h3 class="section-title">Heat Map</h3>
290291

291292
<!-- Status Bar -->
292293
<footer class="status-bar">
294+
<span class="status-item" id="status-brand">
295+
<span class="status-value">Tachyon Profiler</span>
296+
</span>
297+
<span class="status-item" id="status-tagline">
298+
<span class="status-label">Python Sampling Profiler</span>
299+
</span>
293300
<span class="status-item" id="status-location" style="display: none;">
294301
<span class="status-label">File:</span>
295302
<span class="status-value" id="status-file">--</span>

Lib/profiling/sampling/_heatmap_assets/heatmap.css

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,6 @@
2020
z-index: 100;
2121
}
2222

23-
/* Back link in toolbar */
24-
.back-link {
25-
color: white;
26-
text-decoration: none;
27-
padding: 6px 14px;
28-
background: rgba(255, 255, 255, 0.12);
29-
border: 1px solid rgba(255, 255, 255, 0.18);
30-
border-radius: 6px;
31-
font-size: 13px;
32-
font-weight: 500;
33-
transition: all var(--transition-fast);
34-
}
35-
36-
.back-link:hover {
37-
background: rgba(255, 255, 255, 0.22);
38-
border-color: rgba(255, 255, 255, 0.35);
39-
}
40-
4123
/* --------------------------------------------------------------------------
4224
Main Content Area
4325
-------------------------------------------------------------------------- */

Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<span class="brand-subtitle" style="font-family: var(--font-mono); font-size: 13px;"><!-- FILENAME --></span>
1818
</div>
1919
<div class="toolbar">
20-
<a href="index.html" class="back-link">Back to Index</a>
20+
<a href="index.html" class="toolbar-btn" title="Back to Index" aria-label="Back to Index">&#8962;</a>
2121
<button
2222
class="toolbar-btn theme-toggle"
2323
onclick="toggleTheme()"

Lib/profiling/sampling/_shared_assets/base.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ body {
292292
border: 1px solid rgba(255, 255, 255, 0.18);
293293
border-radius: 6px;
294294
cursor: pointer;
295+
text-decoration: none;
295296
transition: all var(--transition-fast);
296297
}
297298

@@ -385,7 +386,8 @@ body {
385386

386387
button:focus-visible,
387388
select:focus-visible,
388-
input:focus-visible {
389+
input:focus-visible,
390+
a.toolbar-btn:focus-visible {
389391
outline: 2px solid var(--python-gold);
390392
outline-offset: 2px;
391393
}

0 commit comments

Comments
 (0)