Repository navigation
Description
Tracking issue for the current Workbench Profiler branch. Bundles a set of
already-implemented Profiler UX fixes with the off-CPU sample-classification
feature still to be built.
Design doc: claude/design/Profiler/11-cpu-sampling-integration.md §8.7
("Sample classification — on-CPU / voluntary-wait / involuntary-stall"), in the
claude/ design repo. Continuation of the #351 CPU-sampling work.
Part A — Profiler UX (implemented on this branch)
- Time Area context menu — right-click a span bar: View in Call Tree
(merged), Zoom to span, Open emission site in editor, Copy span name/id.
Right-click a chunk bar: View in Call Tree (system), Zoom to chunk, Show /
Open system source, Copy system name. Browser context menu suppressed in
the Time Area. - Call Tree row selection — single-click selects + syncs Source Preview
when open; double-click opens the editor; click-to-open underline removed. - Call Tree context menu — Show inline, Open in editor, Focus tree on
this frame, Expand/Collapse subtree, Copy method name / full signature. - "View in Call Tree (merged)" re-rooting — scope now re-roots the tree
at the span/system method viaresolveFrameRootForSite, fixing bogus
ancestors and percentages. (§8.2 frame-root model.) - Source Preview wired to the command palette + View menu toggle.
- Source Preview shows only the enclosing method block — Roslyn-based
FindEnclosingMethodLinesinProfilerSourceController; brace-in-string /
comment safe; falls back to a ±context window for non-C# / non-method lines. - DbMap context menu z-index — portaled to
document.body. - Darker docked-view headers — dockview theme tokens, selected tab darker.
Touched files: panels/profiler/sections/TimeArea.tsx + TimeAreaContextMenu.tsx,
panels/profiler/CallTree.tsx + CallTreeContextMenu.tsx, ProfilerDetail.tsx,
libs/profiler/resolveFrameRoot.ts, stores/useCallTreeScopeStore.ts,
shell/commands/{openSchemaBrowser,baseCommands}.ts, shell/MenuBar.tsx,
panels/DbMap/DbMapContextMenu.tsx, globals.css,
Controllers/ProfilerSourceController.cs (+ Microsoft.CodeAnalysis.CSharp ref),
ProfilerSourceControllerTests.cs, plus vitest specs.
Part B — Off-CPU sample classification (to implement) — §8.7
Microsoft-DotNETCore-SampleProfiler samples every managed thread on a wall-clock
cadence — it is thread-time, not CPU-time. A thread parked at the GC barrier
(Thread.<PollGC>g__PollGCWorker) or blocked in Monitor.Wait is sampled, tagged
Managed, and currently folds into the call tree as if it were the enclosing
method's CPU cost. §8.7 replaces the SampleType proxy with a real classifier.
Every sample → exactly one of three classes (the view, not a name filter,
decides what shows):
| Class | Treatment |
|---|---|
| on-CPU | per-method attribution |
voluntary-wait (Monitor.Wait, WaitHandle, lock, Sleep, IO, await) |
per-method, wall-clock view only |
| involuntary-stall (GC suspension, OS preemption, paging) | never per-method — collapsed into a labelled aggregate node ([GC suspension], [Preempted]) |
Classification = interval joins on data Typhon already captures (no BCL name-matching):
qpc∈ GC-suspension interval (GCSuspendEEBegin/GCRestartEEEnd,ComputeGcSuspensions) → involuntary (GC).- else
qpc∈ off-CPU context-switch slice, byOffCpuCategory:Preempted/QuantumEnd→involuntary (scheduler),Paging→involuntary (paging),SyncWait/UserWait→voluntary-wait. - else → on-CPU.
Implementation across the stack:
- Engine capture — couple the
Typhon:Profiler:Runtime:ThreadScheduling
default toCpuSamplinginTelemetryConfig/ profiler startup (Windows +
elevation only). No new capture — GC-suspension events andEtwSchedulingPump
cswitch slices already exist. - Wire format — no change; classification is a post-hoc Workbench join.
- Workbench server — per-sample classifier (linear merge / binary search
of samples vs GC-suspension intervals +ThreadContextSwitchslices);
CallTreeFolderapplies the view-mode filter and folds involuntary samples
into synthetic[GC suspension]/[Preempted]aggregate nodes; DTO carries
the aggregates + aclassificationAvailableflag. - Workbench client — dynamic mode-toggle label ("On-CPU" when
classification data present, else "Thread time"); render the aggregate nodes
as distinct collapsed entries; updateuseCallTreerequest/response types. - Graceful degradation — no ETW cswitch data (non-Windows / non-elevated /
capture off): GC samples still classified involuntary; everything else falls
back to theSampleTypeproxy;classificationAvailable = false; toggle
reads "Thread time".
Acceptance criteria
- A GC-park /
Monitor.Waitsample no longer inflates the enclosing method's %. - On-CPU view excludes GC pauses and voluntary waits; wall-clock view includes
voluntary waits with full stacks. - Involuntary stalls appear only as labelled aggregate nodes + an always-visible %.
- Non-Windows trace: GC still hidden, view labelled "Thread time", no crash.
- Zero engine hot-path cost — classification is a Workbench-side join only.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
nockawa commentedon May 19, 2026
Implementation plan approved — starting #364 Part B (off-CPU sample classification, §8.7).
Approach: a post-hoc Workbench-side classifier — zero engine hot-path cost, no trace wire-format change.
Typhon:Profiler:Runtime:ThreadSchedulingdefault toCpuSampling(TelemetryConfig); explicit config still wins.SampleClassifier(one chunk-walk, mirrorsSpanInstanceIndex): decodes GC-suspension intervals (kind 75) +ThreadContextSwitchslices (kind 254), classifies each sampleon-CPU / voluntary / involuntary(GC|scheduler|paging)by interval join.CallTreeFolderroutes per class & view mode: on-CPU view folds on-CPU only; wall-clock adds voluntary; involuntary →[GC suspension]/[Preempted]/[Paging]aggregate nodes.CallTreeResponseDtogainsclassificationAvailable.Degraded mode (no context-switch data): GC still aggregated, rest falls back to the
SampleTypeproxy, flagfalse.Note: §8.7 says all classifier inputs are "already in the session" — verified that the kind-254 records sit in the trace chunk stream but were never decoded server-side; the plan adds that one decode pass. Design intent unchanged.
Off-CPU sample classification (#364) + Workbench evolutions (#365) (#366