summaryrefslogtreecommitdiffstats
path: root/Lib/profiling/sampling/_flamegraph_assets/flamegraph_template.html
blob: 936c9adfc8c519c4319c1deca90a68b3ca492e95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!doctype html>
<html lang="en" data-theme="light">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Tachyon Profiler - Flamegraph Report</title>
    <!-- INLINE_VENDOR_D3_JS -->
    <!-- INLINE_VENDOR_FLAMEGRAPH_CSS -->
    <!-- INLINE_VENDOR_FLAMEGRAPH_JS -->
    <!-- INLINE_VENDOR_FLAMEGRAPH_TOOLTIP_JS -->
    <!-- INLINE_CSS -->
  </head>
  <body>
    <div class="app-layout">
      <!-- Top Bar -->
      <header class="top-bar">
        <div class="brand">
          <div class="brand-logo" id="navbar-logo"></div>
          <span class="brand-text">Tachyon</span>
          <span class="brand-divider"></span>
          <span class="brand-subtitle">Flamegraph Report</span>
        </div>
        <div class="search-wrapper">
          <input
            type="text"
            id="search-input"
            class="search-input"
            placeholder="Search functions..."
          />
          <button
            class="search-clear"
            id="search-clear"
            onclick="clearSearch()"
            title="Clear search"
          >&times;</button>
        </div>
        <div class="toolbar">
          <button
            class="toolbar-btn"
            onclick="resetZoom()"
            title="Reset zoom"
          >
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
              <path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z"/>
            </svg>
          </button>
          <button
            class="toolbar-btn"
            onclick="exportSVG()"
            title="Export SVG"
          >
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
              <path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5"/><path d="M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708z"/>
            </svg>
          </button>
          <a
            class="toolbar-btn"
            href="https://docs.python.org/<!-- PYTHON_VERSION -->/library/profiling.sampling.html"
            target="_blank"
            title="Documentation"
          >
            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
              <path d="M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
            </svg>
          </a>
          <button
            class="toolbar-btn theme-toggle"
            onclick="toggleTheme()"
            title="Toggle theme"
            id="theme-btn"
          >
            <svg class="icon-moon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
              <path d="M6 .278a.77.77 0 0 1 .08.858 7.2 7.2 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277q.792-.001 1.533-.16a.79.79 0 0 1 .81.316.73.73 0 0 1-.031.893A8.35 8.35 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.75.75 0 0 1 6 .278M4.858 1.311A7.27 7.27 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.32 7.32 0 0 0 5.205-2.162q-.506.063-1.029.063c-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286"/>
            </svg>
            <svg class="icon-sun" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" style="display:none">
              <path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6m0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8M8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0m0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13m8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5M3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8m10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0m-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0m9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707M4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708"/>
            </svg>
          </button>
        </div>
      </header>

      <!-- Main Content -->
      <div class="main-content">
        <!-- Sidebar -->
        <aside class="sidebar" id="sidebar">
          <button
            class="sidebar-toggle"
            onclick="toggleSidebar()"
            title="Toggle sidebar"
            aria-label="Toggle sidebar"
          >
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none">
              <path d="M10 12L6 8L10 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
            </svg>
          </button>
          <div class="sidebar-resize-handle" id="sidebar-resize-handle"></div>

          <div class="sidebar-content">
            <!-- Logo Section -->
            <div class="sidebar-logo">
              <div class="sidebar-logo-img"><!-- INLINE_LOGO --></div>
            </div>

            <!-- View Mode Section -->
            <section class="sidebar-section view-mode-section collapsible" id="view-mode-section">
              <button class="section-header" onclick="toggleSection('view-mode-section')">
                <h3 class="section-title">View Mode</h3>
                <svg class="section-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
                  <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </button>
              <div class="section-content">
                <div class="toggle-switch" id="toggle-invert" title="Toggle between standard and inverted flamegraph view" tabindex="0">
                  <span class="toggle-label active" data-text="Flamegraph">Flamegraph</span>
                  <div class="toggle-track"></div>
                  <span class="toggle-label" data-text="Inverted Flamegraph">Inverted Flamegraph</span>
                </div>
              </div>
            </section>

            <!-- Profile Summary Section -->
            <section class="sidebar-section collapsible" id="summary-section">
              <button class="section-header" onclick="toggleSection('summary-section')">
                <h3 class="section-title">Profile Summary</h3>
                <svg class="section-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
                  <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </button>
              <div class="section-content">
                <div class="summary-grid">
                  <div class="summary-card" id="summary-samples">
                    <div class="summary-icon">📊</div>
                    <div class="summary-data">
                      <div class="summary-value" id="stat-total-samples">--</div>
                      <div class="summary-label">Total Samples</div>
                    </div>
                  </div>
                  <div class="summary-card" id="summary-duration">
                    <div class="summary-icon"></div>
                    <div class="summary-data">
                      <div class="summary-value" id="stat-duration">--</div>
                      <div class="summary-label">Duration</div>
                    </div>
                  </div>
                  <div class="summary-card" id="summary-rate">
                    <div class="summary-icon"></div>
                    <div class="summary-data">
                      <div class="summary-value" id="stat-sample-rate">--</div>
                      <div class="summary-label">Samples/sec</div>
                    </div>
                  </div>
                  <div class="summary-card" id="summary-functions">
                    <div class="summary-icon">λ</div>
                    <div class="summary-data">
                      <div class="summary-value" id="stat-functions">--</div>
                      <div class="summary-label">Functions</div>
                    </div>
                  </div>
                </div>
                <!-- Efficiency Bar -->
                <div class="efficiency-section" id="efficiency-section" style="display: none;">
                  <div class="efficiency-header">
                    <span class="efficiency-label">Sampling Efficiency</span>
                    <span class="efficiency-value" id="stat-efficiency">--</span>
                  </div>
                  <div class="efficiency-bar">
                    <div class="efficiency-fill" id="efficiency-fill"></div>
                  </div>
                  <div class="missed-samples-header">
                    <span class="efficiency-label">Missed samples</span>
                    <span class="efficiency-value" id="stat-missed-samples">--</span>
                  </div>
                  <div class="efficiency-bar">
                    <div class="efficiency-fill" id="missed-samples-fill"></div>
                  </div>
 
                </div>
              </div>
            </section>

            <!-- Thread Stats Section (GIL/GC) -->
            <section class="sidebar-section thread-stats-section collapsible" id="thread-stats-bar" style="display: none;">
              <button class="section-header" onclick="toggleSection('thread-stats-bar')">
                <h3 class="section-title">Runtime Stats</h3>
                <svg class="section-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
                  <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </button>
              <div class="section-content">
                <div class="stats-grid">
                  <div class="stat-tile stat-tile--green" id="gil-held-stat">
                    <div class="stat-tile-value" id="gil-held-pct">--</div>
                    <div class="stat-tile-label">GIL Held</div>
                  </div>
                  <div class="stat-tile stat-tile--red" id="gil-released-stat">
                    <div class="stat-tile-value" id="gil-released-pct">--</div>
                    <div class="stat-tile-label">GIL Released</div>
                  </div>
                  <div class="stat-tile stat-tile--yellow" id="gil-waiting-stat">
                    <div class="stat-tile-value" id="gil-waiting-pct">--</div>
                    <div class="stat-tile-label">Waiting GIL</div>
                  </div>
                  <div class="stat-tile stat-tile--purple" id="gc-stat">
                    <div class="stat-tile-value" id="gc-pct">--</div>
                    <div class="stat-tile-label">GC</div>
                  </div>
                  <div class="stat-tile stat-tile--red" id="exc-stat">
                    <div class="stat-tile-value" id="exc-pct">--</div>
                    <div class="stat-tile-label">Exception</div>
                  </div>
                </div>
              </div>
            </section>

            <!-- Hotspots Section -->
            <section class="sidebar-section collapsible" id="hotspots-section">
              <button class="section-header" onclick="toggleSection('hotspots-section')">
                <h3 class="section-title">Hotspots</h3>
                <svg class="section-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
                  <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </button>
              <div class="section-content">
              <div class="hotspot" id="hotspot-1">
                <div class="hotspot-rank hotspot-rank--1">1</div>
                <div class="hotspot-info">
                  <div class="hotspot-func" id="hotspot-func-1">--</div>
                  <div class="hotspot-file" id="hotspot-file-1">--</div>
                  <div class="hotspot-stats">
                    <span class="hotspot-percent" id="hotspot-percent-1">--</span>
                    <span id="hotspot-samples-1"></span>
                  </div>
                </div>
              </div>
              <div class="hotspot" id="hotspot-2">
                <div class="hotspot-rank hotspot-rank--2">2</div>
                <div class="hotspot-info">
                  <div class="hotspot-func" id="hotspot-func-2">--</div>
                  <div class="hotspot-file" id="hotspot-file-2">--</div>
                  <div class="hotspot-stats">
                    <span class="hotspot-percent" id="hotspot-percent-2">--</span>
                    <span id="hotspot-samples-2"></span>
                  </div>
                </div>
              </div>
              <div class="hotspot" id="hotspot-3">
                <div class="hotspot-rank hotspot-rank--3">3</div>
                <div class="hotspot-info">
                  <div class="hotspot-func" id="hotspot-func-3">--</div>
                  <div class="hotspot-file" id="hotspot-file-3">--</div>
                  <div class="hotspot-stats">
                    <span class="hotspot-percent" id="hotspot-percent-3">--</span>
                    <span id="hotspot-samples-3"></span>
                  </div>
                </div>
              </div>
              </div>
            </section>

            <!-- Thread Filter Section -->
            <section class="sidebar-section filter-section" id="thread-section" style="display: none;">
              <label class="filter-label" for="thread-filter">Thread Filter</label>
              <select
                id="thread-filter"
                class="filter-select"
                onchange="filterByThread()"
              >
                <option value="all">All Threads</option>
              </select>
            </section>

            <!-- Legend Section -->
            <section class="sidebar-section legend-section collapsible" id="legend-section">
              <button class="section-header" onclick="toggleSection('legend-section')">
                <h3 class="section-title">Heat Map</h3>
                <svg class="section-chevron" width="12" height="12" viewBox="0 0 12 12" fill="none">
                  <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
              </button>
              <div class="section-content">
              <div class="legend">
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-8)"></div>
                  <span class="legend-label">Hottest</span>
                  <span class="legend-range">&ge;60%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-7)"></div>
                  <span class="legend-label">Very Hot</span>
                  <span class="legend-range">35-60%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-6)"></div>
                  <span class="legend-label">Hot</span>
                  <span class="legend-range">18-35%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-5)"></div>
                  <span class="legend-label">Warm</span>
                  <span class="legend-range">12-18%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-4)"></div>
                  <span class="legend-label">Medium</span>
                  <span class="legend-range">6-12%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-3)"></div>
                  <span class="legend-label">Cool</span>
                  <span class="legend-range">3-6%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-2)"></div>
                  <span class="legend-label">Cold</span>
                  <span class="legend-range">1-3%</span>
                </div>
                <div class="legend-item">
                  <div class="legend-color" style="background: var(--heat-1)"></div>
                  <span class="legend-label">Coldest</span>
                  <span class="legend-range">&lt;1%</span>
                </div>
              </div>
              </div>
            </section>
          </div>
        </aside>

        <!-- Chart Area -->
        <main class="chart-area">
          <div id="chart"></div>
        </main>
      </div>

      <!-- Status Bar -->
      <footer class="status-bar">
        <span class="status-item" id="status-brand">
          <span class="status-value">Tachyon Profiler</span>
        </span>
        <span class="status-item" id="status-tagline">
          <span class="status-label">Python Sampling Profiler</span>
        </span>
        <span class="status-item" id="status-location" style="display: none;">
          <span class="status-label">File:</span>
          <span class="status-value" id="status-file">--</span>
        </span>
        <span class="status-item" id="status-func-item" style="display: none;">
          <span class="status-label">Func:</span>
          <span class="status-value" id="status-func">--</span>
        </span>
        <span class="status-item" id="status-time-item" style="display: none;">
          <span class="status-label">Time:</span>
          <span class="status-value" id="status-time">--</span>
        </span>
        <span class="status-item" id="status-percent-item" style="display: none;">
          <span class="status-value accent" id="status-percent">--</span>
        </span>
      </footer>
    </div>

    <!-- INLINE_JS -->
  </body>
</html>