microsoft / microsoft/perfview

ThreadID is uint64 in nettrace v4, but handled as int in EventPipeEventSource.

Open
#1,446 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
4.7k
Forks
775
Avg merge
5d 11h
Merged PRs (30d)
9

Description

There is currently a downcast of ThreadID read from nettrace v4 into a int. On platforms using pointers as thread id's, there is a risk we will get negative thread id's showing up in SpeedScope and Perfview. It doesn't seem to break anything, but looks "wrong" when displayed and could in theory cause collisions on 64-bit systems (below is from a 32-bit Arm Android trace):

image

What we probably need to do is changing ThreadID to a long (unlong to match nettrace v4) from here, https://github.com/microsoft/perfview/blob/8a34d2d64bc958902b2fa8ea5799437df57d8de2/src/TraceEvent/EventPipe/EventPipeEventSource.cs#L1485 and all the way up the parsing logic.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/TraceEvent/EventPipe/EventPipeEventSource.cs around line 1485 and follow the ThreadID parsing logic upward and downstream. Trace the type through the relevant EventPipe and display paths, then verify that nettrace v4 thread IDs remain representable without negative values or collisions in SpeedScope and PerfView.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.