Add search with match highlighting#51
Merged
Merged
Conversation
Adds a SearchControls component to FullFlameGraph and the CLI output. Typing a query matches frames by function or file name, highlights all matches in the flame graph (non-matches are dimmed), and Enter or the navigation buttons cycle through matches hottest-first. Also fixes two bugs in FullFlameGraph's internal frame list that search exposed: frame names resolved through the wrong stringTable accessor (every frame was named func_N), and node IDs missing the root/ prefix used by the renderer, which broke selection lookups. Closes #24
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.
Closes #24
What
Adds frame search to
FullFlameGraphand the CLI-generated HTML:SearchControlscomponent: a search input with prev/next navigation, match counter, and keyboard support (Enter / Shift+Enter cycle through matches, Escape clears).How
FrameRendereraccepts an optional set of highlighted frame IDs and computes per-frame opacity from it; text labels reuse the same opacity map.FlameGraphRendererexposessetHighlightedFrames(frameIds | null), which re-renders immediately without triggering zoom animations.FlameGraphgets ahighlightedFrameIdsprop, re-applied when the renderer is recreated (e.g. toggling "Show App Code Only" mid-search).FullFlameGraphgets ashowSearchprop (defaulttrue) and wiresSearchControlsmatches intoFlameGraph.Bug fixes
Search is the first feature to read frame names from
FullFlameGraph's internal frame list, and it exposed two pre-existing bugs there:profile.stringTable[i]instead ofprofile.stringTable.strings[i], so every frame was namedfunc_N. Fixed, and file name / line number are now extracted too.root/prefix used by the renderer andframeMap, so selections resolved to nothing (zeroed values in Stack Details, no sync with hottest-frames navigation).Testing
tests/search-controls.spec.ts(9 tests): rendering, match counting, file-name matching, match cycling, Escape behavior, and a canvas-level check that searching actually changes the rendering and clearing restores it.