.claude/skills/profile-coverage/SKILL.md
Review profiler instrumentation coverage and recommend new instrumentation points
npx skillsauth add cwilliams5/Alt-Tabby profile-coverageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enter planning mode. Review which functions are instrumented for profiling and identify gaps. This is a review/discussion step — do not implement instrumentation changes without approval.
Alt-Tabby has a build-time strip profiler (src/shared/profiler.ahk). Functions are instrumented with Profiler.Enter("FuncName") ; @profile / Profiler.Leave() ; @profile pairs. In release builds, tools/compile.ps1 strips all ; @profile lines — true zero cost. In --profile builds, the profiler records QPC-timestamped events to a ring buffer and exports speedscope flame graphs.
The static analysis check validates balanced Enter/Leave per function (sub-check profile_markers in tests/check_batch_directives.ps1) — catches the early-return problem.
Run:
powershell -File tools/query_instrumentation.ps1 -Save
This writes temp/INSTRUMENTATION_MAP.md with every function in src/gui/, src/core/, src/shared/ and whether it's currently instrumented.
Read it and summarize: how many functions total, how many instrumented, coverage %.
For every uninstrumented function, research it and classify:
Use query_function.ps1 <name> to read function bodies. Use query_interface.ps1 <filename> to see a file's public API.
The hot path is: Alt down → Tab → show overlay → paint → Alt up → activate window. But "hot path relevant" is BROADER than "directly in the hot path." It includes:
Critical "On" and runs on a timer or Windows callback. If it's executing when the user presses Alt, the Critical section blocks the hotkey callback until it finishes.A function running on a 5-second background timer that holds Critical for 50ms IS hot-path-relevant because there's a 1% chance per Alt-Tab that it's mid-execution.
Before classifying any MAYBE, check: is its parent already instrumented? Are its children?
When the parent IS instrumented:
When the children ARE instrumented:
When siblings ARE instrumented but there's a gap:
When instrumenting a proposed-YES parent:
Post-#177, the rendering pipeline has extensive uninstrumented hot paths. The profiler currently covers GUI_Repaint (total paint time) but not the breakdown within:
Shader_PreRender in d2d_shader.ahk): 40+ COM calls per shader per frame (cbuffer map, compute dispatch, D3D11 state setup, Draw, GPU→CPU readback). Runs N times per frame (once per active shader layer + mouse + selection + hover). Zero instrumentation currently.FX_DrawShaderLayers, FX_DrawMouseEffect, FX_DrawSelectionEffect, FX_DrawHoverEffect in gui_effects.ahk): DrawImage calls for intermediate texture compositing. Only mouse effect has QPC measurement (for adaptive FPS skip).D2D_SetClipRect, D2D_Commit in gui_overlay.ahk): Clip update + commit on resize. No timing._Anim_FrameLoop in gui_animation.ahk): Compositor clock wait / waitable signal / spin-wait. Frame delta computed (gAnim_FrameDt) but not profiler-instrumented.When classifying functions, pay special attention to these areas — they represent the majority of per-frame GPU-side cost but are invisible to the profiler.
Produce a summary of all YES recommendations:
| File | Function | Why (one line) |
|------|----------|----------------|
| gui_paint.ahk | _GUI_PaintOverlay | Variable cost per-item, parent GUI_Repaint can't show which item is slow |
And a count: "X new functions recommended, bringing total from Y to Z (N% coverage)."
Present the summary table and ask if the user wants to discuss any items before implementation. Do NOT implement instrumentation changes in this skill — it is review only.
tools
Create a new git worktree and switch the session into it
tools
Spawn agent to trace code flow via query tools — answer only, no context cost
tools
Commit, push, and create a PR for the current branch
tools
Retire a shader by moving its files to legacy/shaders_retired