Skip to content

Adds diffing capability for flame graphs - #50

Closed
ESultanik wants to merge 9 commits into
masterfrom
flamegraph
Closed

ESultanik wants to merge 9 commits into
masterfrom
flamegraph

Conversation

@ESultanik

@ESultanik ESultanik commented Jan 7, 2022

Copy link
Copy Markdown
Collaborator
$ cat flamegraph1
unix`_sys_sysenter_post_swapgs 1401
unix`_sys_sysenter_post_swapgs;genunix`close 5
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf 85
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_closef 26
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_setf 5
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_getstate 6
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_unfalloc 2
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`closef 48
$ cat flamegraph2
unix`_sys_sysenter_post_swapgs 1402
unix`_sys_sysenter_post_swapgs;genunix`close 5
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf 85
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_closef 26
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_setf 5
unix`_sys_sysenter_post_swapgs;genunix`closeandsetf;genunix`audit_getstate 6
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_unfalloc 2
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`closef 48
$ graphtage flamegraph1 flamegraph2
unix`_sys_sysenter_post_swapgs;genunix`close 5
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf 85
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_closef 26
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;c2audit`audit_setf 5
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`audit_unfalloc 2
unix`_sys_sysenter_post_swapgs;genunix`close;genunix`closeandsetf;genunix`closef 48
unix`_sys_sysenter_post_swapgs 1̶4̶0̶1̶ -> 1̟4̟0̟2̟
unix`_sys_sysenter_post_swapgs;̶g̶e̶n̶u̶n̶i̶x̶`̶c̶l̶o̶s̶e̶;genunix`closeandsetf;genunix`audit_getstate 6

@ESultanik ESultanik added the enhancement New feature or request label Jan 7, 2022
@ESultanik
ESultanik requested a review from ehennenfent January 7, 2022 16:31
@ESultanik ESultanik self-assigned this Jan 7, 2022
@ESultanik

Copy link
Copy Markdown
Collaborator Author

Superseded by #181, which rebuilds this on current master as a new branch rather than merging.

Two reasons this branch was not carried forward:

  1. Its tip produces an empty diff for the case the feature exists to serve. b84f138 gave StackTrace an __eq__/__hash__ that compare only the function names, and FlameGraph is a MultiSetNode, so MultiSetNode.edits() compares the children as HashableCounters. Two profiles that differ only in sample counts have equal counters, so the result is Match(self, node, 0). The example in the description above was generated before that commit, so it does not show this. Add a filetype for diffing flame graphs #181 keeps a regression test that fails if the frames-only equality is restored.
  2. Its core-library changes are superseded or regressive after 293 commits. The bounds.py progress bars wrap the pre-heap make_distinct loop that perf: Use heap in make_distinct() for O(n log n) complexity #110 rewrote; ContainerNode.__eq__ duplicates the one at sequences.py:185 and compares with zip, so [a] == [a, b]; the CompoundEdit defaults duplicate edits.AbstractEdit; deleting KeyValuePairNode.__eq__/__hash__ would drop the cached hash added at graphtage.py:190; and both progress bars bind DEFAULT_PRINTER at import, which Make --no-status and --quiet suppress the progress bar #135 moved behind get_default_printer() so --quiet is honored.

#181 keeps the parser and the folded-stacks rendering, and re-models the nodes as a mapping from stack trace to sample count so that identical stack traces pair by key.

The flamegraph branch is left in place so these commits stay reachable.

@ESultanik ESultanik closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant