MCPcopy Index your code
hub / github.com/python/cpython / applySpanHeatColors

Function applySpanHeatColors

Lib/profiling/sampling/_heatmap_assets/heatmap.js:347–360  ·  view source on GitHub ↗

* Apply intensity-based heat colors to source spans * Hot spans get orange highlight, cold spans get dimmed * @param {boolean} enable - Whether to enable or disable span coloring

(enable)

Source from the content-addressed store, hash-verified

345 * @param {boolean} enable - Whether to enable or disable span coloring
346 */
347function applySpanHeatColors(enable) {
348 document.querySelectorAll('.instr-span').forEach(span => {
349 const samples = enable ? (parseInt(span.dataset.samples) || 0) : 0;
350 if (samples > 0) {
351 const intensity = samples / (parseInt(span.dataset.maxSamples) || 1);
352 span.style.backgroundColor = calculateHeatColor(intensity);
353 span.style.borderRadius = '2px';
354 span.style.padding = '0 1px';
355 span.style.cursor = 'pointer';
356 } else {
357 span.style.cssText = '';
358 }
359 });
360}
361
362// ========================================
363// SPAN TOOLTIPS

Callers 1

toggleSpecViewFunction · 0.85

Calls 1

calculateHeatColorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…