Skip to content

Conversation

@mdh1418
Copy link
Member

@mdh1418 mdh1418 commented Dec 8, 2025

This PR gives dotnet-trace collect-linux the option --probe to display which .NET processes are capable of parsing an EventPipe UserEvents IPC Command without collecting a trace. The option is compatible with -p|--process-id and -n|--name to probe a single .NET process. It is also compatible with -o|--output to generate a csv file ordered with supported processes first followed by unsupported in the format pid,processName,supportsCollectLinux (e.g. 1234,MyApp,true).

This also changes the behavior of collect-linux when tracing a single process from a silent failure to erroring with a message indicating that the single .NET process' runtime is not > 10.0.0.

Support is determined as .NET Runtime 10.0.0 Release and onward.

Probe option

  --probe           Probe .NET processes for support of the EventPipe UserEvents IPC command used by collect-linux, without collecting a trace. Results list supported processes first. Use '-o stdout' to print CSV (pid,processName,supportsCollectLinux) to the 
                    console, or '-o <file>' to write the CSV. Probe a single process with -n|--name or -p|--process-id.

Example outputs

One process that running .NET 10.0.0 and another using a preview.

./artifacts/bin/dotnet-trace/Debug/net8.0/dotnet-trace collect-linux --probe
==========================================================================================
The collect-linux verb is a new preview feature and relies on an updated version of the
.nettrace file format. The latest PerfView release supports these trace files but other
ways of using the trace file may not work yet. For more details, see the docs at
https://learn.microsoft.com/dotnet/core/diagnostics/dotnet-trace.
==========================================================================================
Probing .NET processes for support of the EventPipe UserEvents IPC command used by collect-linux. Requires runtime '10.0.0' or later.
.NET processes that support the command:
3802935 MyApp

.NET processes that do NOT support the command:
3809123 dotnet - Detected runtime: '10.0.0-rc.1.25451.107'

Printing csv to console

./artifacts/bin/dotnet-trace/Debug/net8.0/dotnet-trace collect-linux --probe -o stdout
==========================================================================================
The collect-linux verb is a new preview feature and relies on an updated version of the
.nettrace file format. The latest PerfView release supports these trace files but other
ways of using the trace file may not work yet. For more details, see the docs at
https://learn.microsoft.com/dotnet/core/diagnostics/dotnet-trace.
==========================================================================================
pid,processName,supportsCollectLinux
3802935,MyApp,true
3809123,dotnet,false

Writing results to csv file

./artifacts/bin/dotnet-trace/Debug/net8.0/dotnet-trace collect-linux --probe -o probe.out
==========================================================================================
The collect-linux verb is a new preview feature and relies on an updated version of the
.nettrace file format. The latest PerfView release supports these trace files but other
ways of using the trace file may not work yet. For more details, see the docs at
https://learn.microsoft.com/dotnet/core/diagnostics/dotnet-trace.
==========================================================================================
Successfully wrote EventPipe UserEvents IPC command support results to '/home/mihw/repo/diagnostics/probe.out'.

Generated csv

pid,processName,supportsCollectLinux
3802935,MyApp,true
3809123,dotnet,false

Targeting a single process running .NET runtime 10.0.0

./artifacts/bin/dotnet-trace/Debug/net8.0/dotnet-trace collect-linux --probe -n MyApp
==========================================================================================
The collect-linux verb is a new preview feature and relies on an updated version of the
.nettrace file format. The latest PerfView release supports these trace files but other
ways of using the trace file may not work yet. For more details, see the docs at
https://learn.microsoft.com/dotnet/core/diagnostics/dotnet-trace.
==========================================================================================
.NET process 'MyApp (3802935)' supports the EventPipe UserEvents IPC command used by collect-linux.

Targeting a single process older than .NET runtime 10.0.0 release

./artifacts/bin/dotnet-trace/Debug/net8.0/dotnet-trace collect-linux --probe -p 3809123
==========================================================================================
The collect-linux verb is a new preview feature and relies on an updated version of the
.nettrace file format. The latest PerfView release supports these trace files but other
ways of using the trace file may not work yet. For more details, see the docs at
https://learn.microsoft.com/dotnet/core/diagnostics/dotnet-trace.
==========================================================================================
.NET process 'dotnet (3809123)' does NOT support the EventPipe UserEvents IPC command used by collect-linux.
Required runtime: '10.0.0'. Detected runtime: '10.0.0-rc.1.25451.107'.

@mdh1418 mdh1418 requested a review from a team as a code owner December 8, 2025 00:58
@mdh1418
Copy link
Member Author

mdh1418 commented Dec 8, 2025

I'm going through some refactoring to make things cleaner, and I'm planning on utilizing the --out option to emit a file listing the processes as some form of Pid,Name,Supports, intended to assist with automation.

@mdh1418 mdh1418 force-pushed the add_collect_linux_probe branch from af59bda to 8312e6c Compare December 10, 2025 00:05
Copy link
Member

@lateralusX lateralusX left a comment

Choose a reason for hiding this comment

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

LGTM!

@mdh1418 mdh1418 merged commit de92ce2 into dotnet:main Dec 11, 2025
19 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.

2 participants