Skip to content

Conversation

@ivonastojanovic
Copy link
Contributor

@ivonastojanovic ivonastojanovic commented Dec 5, 2025

Introduce an inverted flamegraph view that aggregates all leaf nodes. In a standard flamegraph, if a hot function is called from multiple locations, it appears multiple times as separate leaf nodes. In the inverted flamegraph, all occurrences of the same leaf function are merged into a single aggregated node, showing the total hotness of that function in one place.

In this inverted view, the children of each aggregated hot function represent its callers, the functions that led to that leaf in the original call tree.

Standard flamegraph:
image

Inverted flame graph:
image

Introduce an inverted flamegraph view that aggregates all leaf
nodes. In a standard flamegraph, if a hot function is called
from multiple locations, it appears multiple times as separate
leaf nodes. In the inverted flamegraph, all occurrences of the
same leaf function are merged into a single aggregated node,
showing the total hotness of that function in one place.

In this inverted view, the children of each aggregated hot
function represent its callers, the functions that led to that
leaf in the original call tree.
@ivonastojanovic ivonastojanovic marked this pull request as ready for review December 9, 2025 22:12
@pablogsal
Copy link
Member

@ivonastojanovic unfortunately we had some merge conflicts. Can you fix them when you have some time?

Resolved conflicts:
- flamegraph.js: Combined opcode mapping initialization with inverted flamegraph setup
- heatmap.css: Kept heatmap-specific toggle overrides (base toggle styles in base.css)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@pablogsal
Copy link
Member

@ivonastojanovic i fixed the conflicts. We still have this weird bug where if a thread has a single frame it dissapears in inverted version

@pablogsal
Copy link
Member

Ok I think I found the problem, can you double check 500c484?

@pablogsal pablogsal merged commit 3b38388 into python:main Dec 12, 2025
50 checks passed
fatelei pushed a commit to fatelei/cpython that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants