Improves how process weights are calculated and displayed in the profile loading UI. Default filter out Idle#43
Conversation
…ses responses Bypass the ProfileLoadWindow UI for process list extraction in GetAvailableProcessesAsync and call ETWProfileDataProvider.FindTraceProcesses directly. The previous approach opened a UI dialog and scraped its ListView, but a race condition from double TextChanged invocation (binding + reflection) could cause the wait logic to return an incomplete intermediate list with empty Name/ImageFileName/CommandLine for most processes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ove ProfileLoadWindow layout
- Fix ProcessSummaryBuilder hash mutation bug: key dictionaries by ProcessId (int)
instead of ProfileProcess to prevent duplicate entries when Name changes after
dictionary insertion (e.g., two Idle rows with split weights)
- Add WeightPercentageExcludingIdle to ProcessSummary, pre-calculated for instant
toggling between with/without Idle percentages
- Add "Exclude Idle" checkbox to ProfileLoadWindow (default: checked) that filters
PID 0 and shows recalculated weight percentages
- MCP get_available_processes and open_trace now exclude Idle and use non-idle
percentages for more meaningful LLM analysis
- Restructure ProfileLoadWindow layout: DockPanel with buttons docked at bottom,
process list fills remaining vertical space, removed SizeToContent to prevent
window from extending off-screen
There was a problem hiding this comment.
Pull request overview
This PR updates process weight calculations and the profile loading UI to better handle the Windows Idle/kernel process by adding a new “excluding Idle” weight percentage and making Idle filtering the default behavior.
Changes:
- Added
WeightPercentageExcludingIdletoProcessSummaryand computed it inProcessSummaryBuilder. - Updated
ProfileLoadWindowUI to display the excluding-idle percentage by default and added an “Exclude Idle” toggle that also hides PID 0. - Updated
McpActionExecutor.GetAvailableProcessesAsyncto pull process summaries directly fromETWProfileDataProvider.FindTraceProcesses(avoiding UI coupling) and to default-exclude PID 0 using the new percentage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ProfileExplorerUI/Windows/ProfileLoadWindow.xaml.cs | Applies an Idle filter to the process list view and dynamically switches the displayed weight binding based on the toggle. |
| src/ProfileExplorerUI/Windows/ProfileLoadWindow.xaml | UI layout adjustments; adds “Exclude Idle” checkbox; updates weight column binding and layout. |
| src/ProfileExplorerUI/Mcp/McpActionExecutor.cs | Switches to backend process extraction via FindTraceProcesses and defaults to excluding Idle with non-idle percentages. |
| src/ProfileExplorerCore/Profile/Data/ProcessSummaryBuilder.cs | Uses PID-based maps and computes total and non-idle weight percentages for process summaries. |
| src/ProfileExplorerCore/Profile/Data/IProfileDataProvider.cs | Extends ProcessSummary contract with WeightPercentageExcludingIdle for serialization/transport. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…e, reorder ProtoMember tags - Use ETWEventProcessor.KernelProcessId instead of magic 0 in idle filters - Set WeightPercentageExcludingIdle to WeightPercentage for PID 0 to avoid >100% values - Reorder ProtoMember tags to ascending order (4, 5) in ProcessSummary
| } | ||
| } else { | ||
| weightPercentageExcludingIdle = 0; | ||
| } |
There was a problem hiding this comment.
nit: for more consistent conditional / ternary style immediately preceding this block, i'd personally suggest something like:
double weightPercentageExcludingIdle;
if (nonIdleWeightTicks > 0) {
// For the idle/kernel process, the excluding-idle percentage is not meaningful.
// Set it equal to the overall weight percentage to avoid confusing values.
weightPercentageExcludingIdle = pair.Key != ETW.ETWEventProcessor.KernelProcessId
? 100 * (double)pair.Value.Ticks / nonIdleWeightTicks
: weightPercentage;
} else {
weightPercentageExcludingIdle = 0;
}
to replace the highlighted part
There was a problem hiding this comment.
Though ack that nesting a ternary within an if-else might start to look messy itself
This pull request improves how process weights are calculated and displayed in the profile loading UI, especially regarding the "Idle" process. It introduces a new weight percentage that excludes the Idle process, updates the backend to support this calculation, and modifies the UI to allow users to toggle the exclusion of Idle. Additionally, it streamlines the process information extraction logic and makes several UI layout improvements.
Backend logic and data model changes:
WeightPercentageExcludingIdleto theProcessSummarydata model to represent process weight percentages calculated without the Idle process.ProcessSummaryBuilderto use process IDs as dictionary keys, calculate non-idle total weights, and populate the newWeightPercentageExcludingIdlefield. [1] [2] [3] [4]UI and process list improvements:
ProfileLoadWindow.xamlto displayWeightPercentageExcludingIdleinstead of the original percentage and added a checkbox to allow users to exclude or include the Idle process in calculations. [1] [2]McpActionExecutorto extract process summaries directly (bypassing the UI window), filter out the Idle process, and use the new non-idle weight percentages for process filtering and display.Code cleanup:
ExtractProcessInfoAsyncmethod fromMcpActionExecutor, as process information is now obtained directly from the backend.