Skip to content

Add self-tracing tooling and standardize trace macros#72

Merged
traplol merged 1 commit intomainfrom
self-tracing
Mar 21, 2026
Merged

Add self-tracing tooling and standardize trace macros#72
traplol merged 1 commit intomainfrom
self-tracing

Conversation

@traplol
Copy link
Copy Markdown
Owner

@traplol traplol commented Mar 21, 2026

Summary

  • Add scripts/insert_trace.py — libclang-based tool to automatically insert/remove TRACE_FUNCTION_CAT macros in C++ source files, with dry-run by default, --commit to apply, --remove to strip and re-insert, .trace_ignore file support, and single-statement function skipping
  • Add scripts/find_noisy_traces.py — streaming analyzer to identify high-frequency trace events in large Chrome trace JSON files
  • Add .trace_ignore — ignore list for functions too hot to trace (SAX parser callbacks, flame graph tree building, KeyBindings::is_pressed)
  • Standardize all existing manual TRACE_SCOPE_CAT calls to TRACE_FUNCTION_CAT and remove redundant mid-function traces

Test plan

  • Run python3 scripts/insert_trace.py --only "src/**/*.cpp" and verify dry-run output looks correct
  • Run python3 scripts/insert_trace.py --remove --only "src/**/*.cpp" and verify remove + re-insert output
  • Run python3 scripts/find_noisy_traces.py <trace.json> against a trace file
  • Build and run the app, verify tracing still works end to end

🤖 Generated with Claude Code

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>
@traplol traplol merged commit afcbbfe into main Mar 21, 2026
3 checks passed
@traplol traplol deleted the self-tracing branch March 21, 2026 17:08
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.

1 participant