C
C#8mo ago
InsertPi

✅ Collecting hotspot data on Linux in a threaded .NET environment

I'm working on optimizing some parallel code, and would like to be able to profile the code and collect hotspot data so I can determine how much time is spent doing useful work vs. how much time is spent as overhead managing work-sharing across the threadpool I create. I looked at BenchmarkDotNet, but the EtwProfiler is only available on Windows. I've been developing this whole project on Linux, and would prefer to benchmark on Linux as well due to the low OS overhead/idle CPU usage. What is the best way to do this?
4 Replies
Denis
Denis8mo ago
Afaik JetBrains profilers should be cross platform However, those are paid solutions
reflectronic
reflectronic8mo ago
you can use dotnet-trace to export a flame graph that you can view in speedscope.app or about:tracing in chrome https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-trace
dotnet-trace diagnostic tool - .NET CLI - .NET
Learn how to install and use the dotnet-trace CLI tool to collect .NET traces of a running process without the native profiler, by using the .NET EventPipe.
reflectronic
reflectronic8mo ago
(you can also use EventPipeProfiler instead of EtwProfiler in BenchmarkDotNet, all of these options are mostly equivalent)
Accord
Accord8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.