Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: microsoft/perfview
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.2.0
Choose a base ref
...
head repository: microsoft/perfview
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.2.1
Choose a head ref
  • 3 commits
  • 7 files changed
  • 4 contributors

Commits on Apr 3, 2026

  1. Optimize nettrace-to-TraceLog Conversion (#2403)

    * Use min-heap for EventCache.SortAndDispatch
    
    Replace the O(N*T) linear-scan merge in SortAndDispatch with an O(N*log(T))
    min-heap merge, where N is the number of events and T is the number of
    threads. The previous implementation rebuilt a List from LINQ on every call
    and linearly scanned all thread queues for the minimum timestamp per event.
    
    The new implementation uses an array-backed binary min-heap keyed by
    timestamp. After extracting the minimum, only a single O(log T) sift-down
    is needed to restore the heap property. The heap list is reused across
    calls to avoid per-call allocations.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Track active thread queues in EventCache.SortAndDispatch
    
    Maintain a HashSet of thread queues that have pending events instead of
    iterating all threads in the dictionary on every SortAndDispatch call.
    Queues are added to the active set when their first event is enqueued
    and removed when drained. This eliminates the Dictionary.Values
    enumeration which was ~28% of CPU during nettrace-to-TraceLog conversion.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Cache ParsedSymbolMetadata to avoid repeated JSON deserialization
    
    Cache the result of ProcessMappingSymbolMetadataParser.TryParse() in
    ProcessMappingMetadataTraceData so that repeated accesses to the
    ParsedSymbolMetadata property do not re-invoke JSON deserialization.
    The property is accessed twice per mapping event (for PE and ELF
    metadata checks), and the metadata objects are shared across multiple
    mappings via MetadataId. This was ~10% of CPU during conversion.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Avoid redundant FileName string allocations in ProcessMapping handler
    
    Read ProcessMappingTraceData.FileName once into a local variable and pass
    it directly to UniversalMapping(string, ...) instead of going through the
    UniversalMapping(ProcessMappingTraceData, ...) overload. Previously,
    FileName was accessed 3 times per mapping event (IsNullOrEmpty check,
    StartsWith check, and inside UniversalMapping), each time allocating a
    new string via GetShortUTF8StringAt(). String allocation was ~12% of CPU
    in Release-mode profiling.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Reset ParsedSymbolMetadata cache in Dispatch to prevent stale data
    
    TraceEvent objects are reused across callbacks. The cached
    ParsedSymbolMetadata fields were never cleared between dispatches,
    which could return metadata from a previous event if the property
    was accessed on the template object rather than a clone.
    
    Reset _parsedSymbolMetadataCached and _parsedSymbolMetadata at the
    start of Dispatch() before invoking the callback.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Address code review feedback: MinHeap class, Clone override, comments
    
    Refactor the min-heap helpers into a self-contained private MinHeap
    class with XML doc comments on all public methods. Add comments
    explaining the binary heap child index formulas (2i+1, 2i+2). Use
    C# tuple swap syntax instead of a temp variable.
    
    Add Clone() override to ProcessMappingMetadataTraceData to explicitly
    copy the cached ParsedSymbolMetadata fields into the clone. Strings
    are immutable so a shallow copy of the reference is sufficient.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    * Add MinHeap unit tests and improve Build() comment
    
    Make MinHeap generic (MinHeap) and internal so it can be
    tested from the test project. Add 13 unit tests covering: empty heap,
    single element, ascending/descending/random input, duplicate keys,
    ReplaceRoot, RemoveRoot, Clear, and mixed operations. Add a comment
    to Build() explaining why iteration starts at Count/2-1.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    brianrob and Copilot authored Apr 3, 2026
    Configuration menu
    Copy the full SHA
    85f1ca4 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2026

  1. Embed missing System.Text.Json transitive dependencies in PerfView (#…

    …2404)
    
    System.Text.Json 9.0.8 has transitive dependencies on System.IO.Pipelines
    and Microsoft.Bcl.AsyncInterfaces that were not being embedded in the
    self-extracting PerfView EXE. When these DLLs are absent at runtime,
    System.Text.Json fails to parse ProcessMappingMetadata JSON, causing all
    ELF and PE module binary formats to be reported as Unknown. This prevents
    symbol resolution for Linux .nettrace traces.
    
    Add both packages to Directory.Packages.props and embed them as resources
    in PerfView.csproj alongside the existing System.Text.Json dependencies.
    
    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
    brianrob and Copilot authored Apr 4, 2026
    Configuration menu
    Copy the full SHA
    afe5e5d View commit details
    Browse the repository at this point in the history
  2. Update version to 3.2.1 (#2405)

    Agent-Logs-Url: https://github.com/microsoft/perfview/sessions/78f533da-c8ef-489d-ac6c-05e8d856413a
    
    Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
    Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com>
    Copilot and brianrob authored Apr 4, 2026
    Configuration menu
    Copy the full SHA
    543e9e9 View commit details
    Browse the repository at this point in the history
Loading