Conversation
Owner
|
Good find. I view this more as a bugfix. Can't think of a reason why we'd want to collapse different |
dasl-
force-pushed
the
stackcollapse-main-file
branch
5 times, most recently
from
September 13, 2026 22:10
ec91994 to
e4a6589
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
dasl-
force-pushed
the
stackcollapse-main-file
branch
from
September 13, 2026 22:52
e4a6589 to
bd82eb4
Compare
dasl-
marked this pull request as ready for review
September 13, 2026 23:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stackcollapse-phpspy.pldrops thefile:linefield of every frame. PHP names the top-level scope of every file<main>, so every entry point and every included file collapses to the same label and merges into one tower at the base of the flamegraph.Repro
Three distinct files in the trace:
One label after collapsing:
Fix
<main>frames get their file appended, so the repro becomes:The label is the shortest trailing part of the path that is unique among the
<main>files in the trace: usually just the basename, or e.g.admin/index.phpandpublic/index.phpwhen two files share one. Paths are collected while reading and shortened at output time. One consequence, noted in the header comment: the same file can be labelled differently in two captures if a same-named file appears in only one of them.Notes:
Class::<main>. The class prefix is dropped so every file-scope frame reads<main>:file; the frame beneath it already names the method.php -r,eval) is reported with<internal>as its file and stays a plain<main>.;and whitespace in a path become_, since both are delimiters in the folded format.<main>frames are left alone — addingfile:linethere would split a function into a separate frame per callsite.New test
tests/test_stackcollapse_main_file.shhas a canned-input block that pins the labelling rules, and a live phpspy run with nested includes, a method-scope include, two files sharing a basename, and a directory name containing a space. Also updates the header comment'sExample Output, which was already missing thesleepframe on two of three lines.before and after comparisons
ex 1: nested includes
before
after
ex 2: including/requiring a file from a method
before
after
ex 3: a fake app w/ multiple entry points
before
after
🤖 Generated with Claude Code