Internal and external profiling in live/functional tests

2 days ago 5
ARTICLE AD BOX

I have timeout issues in my live tests and I want to capture method timing in the external process under test as well as the live test without having to add more instrumentation to the external process (otel, ifdef, etc).   Everything's c#, net10.

I currently:

From the live test, launch the external process with DOTNET_EnableEventPipe + config + output path

After the test, read the profiling output via EventPipeEventSource and TraceLog.CreateFromEventPipeDataFile

Generate a report including assembly load times, GC, stack sampling and attach that to / link from test

This is leaving gaps of:

The test itself isn't profiled. We do a bit of recorded http proxy setup and client work on the test side that takes some filesystem locks and could be blocking and eating some time

The method timing is derived from periodic stack sampling. This only tells me how often a method exists in the stack when it's sampled, but not how many times the method was invoked or exact start time, end time and duration.

Ideally, I'd like to see every method invocation with start and end times and I could just interleave them from the concurrent tests and see what's blocking, measure real concurrency, etc...

Is there any way to get the clr to emit that?   Are there any free IL rewriters that would do that for me (I remember using Dynatrace years ago and I think it could dynamically instrument any method)

Read Entire Article