microsoft / perfview

PerfView is a CPU and memory performance-analysis tool
http://channel9.msdn.com/Series/PerfView-Tutorial
MIT License
4.05k stars 695 forks source link

TraceEvent: Getting allocation stacks on Linux #2057

Open ocoanet opened 5 days ago

ocoanet commented 5 days ago

I am trying to create a simple OS independent allocation detection program. The detection program:

I can get allocation events (ClrTraceEventParser.GCSampledObjectAllocation) by using the allocations keywords. However, I cannot get stack events (ClrTraceEventParser.ClrStackWalk) by using the ClrTraceEventParser.Keywords.Stack keyword. TraceLog is still able to retrieve stack information from the allocation events using TraceLog.ProcessExtendedData, but the code is internal and seems to be Windows-specific. Also, I would like to avoid converting my event pipe files to ETLX because it consumes too much memory and crashes on low-memory containers.

My questions are:

ocoanet commented 3 days ago

I did additional tests on Linux and it turns out that the trace events contain extended data with stack traces. So, ProcessExtendedData is also useful on Linux even though the data structures used in this method seem to be Windows-specific.

I will probably close this issue because it somehow answers most of my questions. However, it would be nice if I could get the confirmation that:

Also, it would be interesting to know if ClrTraceEventParser.ClrStackWalk can be used to get stacks with dotnet-trace.