Refactor SampleAggregator to handle user-space imageless samples and … - #68
Conversation
…add ProfileAddress for kernel address checks
There was a problem hiding this comment.
Pull request overview
This PR refactors the profiling library’s SampleAggregator so user-space “imageless” (unmapped/JIT/unresolved module) leaf samples are no longer silently dropped from totals, and centralizes kernel-address detection in a shared ProfileAddress helper that Core forwards to.
Changes:
- Add
ProfileAddress.IsKernelAddressinProfileExplorer.Profilingand forward Core’sETWEventProcessor.IsKernelAddressto it. - Update
SampleAggregator.AddSamplesto bucket user-space imageless leaf samples into a single synthetic “(unknown)” function so their weight contributes to the denominator. - Update unit tests to validate user imageless bucketing and kernel imageless dropping behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/ProfileExplorerCore/Profile/ETW/ETWEventProcessor.cs | Replaces local kernel-address logic with a forwarder to the shared ProfileAddress helper. |
| src/ProfileExplorer.Profiling/Profiling/SampleAggregator.cs | Counts user-space imageless samples into a synthetic bucket to preserve correct total-weight denominator semantics. |
| src/ProfileExplorer.Profiling/ProfileAddress.cs | Introduces the shared kernel/user address split helper to avoid duplicated thresholds across components. |
| src/ProfileExplorer.Profiling.Tests/Unit/SampleAggregatorTests.cs | Adjusts/adds tests covering the new imageless sample handling behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/ProfileExplorer.Profiling/Profiling/IpResolver.cs:78
IpResolver.PointerSizeaccepts any integer value; invalid sizes (e.g. 1, 16) will silently fall through to the 64-bit kernel threshold, which can misclassify addresses and is hard to diagnose. Consider validating that the value is either 0 (auto), 4, or 8.
set => explicitPointerSize_ = value;
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/ProfileExplorer.Profiling/Profiling/IpResolver.cs:78
- The new IpResolver.PointerSize setter accepts any integer; values other than 0/4/8 will silently fall into the 64-bit threshold path in ProfileAddress.IsKernelAddress, potentially misclassifying kernel/user addresses. Add validation (and clear derived cache when switching back to auto).
set => explicitPointerSize_ = value;
…add ProfileAddress for kernel address checks