Add self-tracing tooling and standardize trace macros#72
Merged
Conversation
Add scripts to automate TRACE_ macro insertion and identify noisy traces: - scripts/insert_trace.py: libclang-based tool to insert/remove TRACE_FUNCTION_CAT macros with dry-run default, --commit to apply, --remove to clean and re-insert, .trace_ignore support, single-statement function skipping - scripts/find_noisy_traces.py: streaming analyzer for high-frequency trace events - .trace_ignore: functions too hot to trace (SAX callbacks, flame tree building, etc) Standardize all existing manual TRACE_SCOPE_CAT calls to TRACE_FUNCTION_CAT and remove redundant mid-function traces that the automated tool replaces. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
scripts/insert_trace.py— libclang-based tool to automatically insert/removeTRACE_FUNCTION_CATmacros in C++ source files, with dry-run by default,--committo apply,--removeto strip and re-insert,.trace_ignorefile support, and single-statement function skippingscripts/find_noisy_traces.py— streaming analyzer to identify high-frequency trace events in large Chrome trace JSON files.trace_ignore— ignore list for functions too hot to trace (SAX parser callbacks, flame graph tree building,KeyBindings::is_pressed)TRACE_SCOPE_CATcalls toTRACE_FUNCTION_CATand remove redundant mid-function tracesTest plan
python3 scripts/insert_trace.py --only "src/**/*.cpp"and verify dry-run output looks correctpython3 scripts/insert_trace.py --remove --only "src/**/*.cpp"and verify remove + re-insert outputpython3 scripts/find_noisy_traces.py <trace.json>against a trace file🤖 Generated with Claude Code