Skip to content

Refactor SampleAggregator to handle user-space imageless samples and … - #68

Merged
trgibeau merged 4 commits into
mainfrom
user/trgibeau/bugFix2
Jul 30, 2026
Merged

Refactor SampleAggregator to handle user-space imageless samples and …#68
trgibeau merged 4 commits into
mainfrom
user/trgibeau/bugFix2

Conversation

@trgibeau

Copy link
Copy Markdown
Collaborator

…add ProfileAddress for kernel address checks

…add ProfileAddress for kernel address checks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.IsKernelAddress in ProfileExplorer.Profiling and forward Core’s ETWEventProcessor.IsKernelAddress to it.
  • Update SampleAggregator.AddSamples to 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.

Comment thread src/ProfileExplorer.Profiling/Profiling/SampleAggregator.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.PointerSize accepts 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;

Comment thread src/ProfileExplorer.Profiling/Profiling/SampleAggregator.cs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

@trgibeau
trgibeau marked this pull request as ready for review July 29, 2026 23:30
@trgibeau
trgibeau merged commit 9c5c515 into main Jul 30, 2026
7 checks passed
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.

3 participants