This started on stackoverflow, but it might be better to continue this here. I have a long running MVC page that executes DB requests in parallel, and I’d like the results to appear in the profiler timings.
I’ve managed to make this happen by implementing my own BaseProfilerProvider
for the async task, and then adding a synchronous continuation that copies the SQL timings back to the step that initiated the async call (see the SO answer for the code).
However this seems like a very messy way to do it. Longer term I’d be interested in having a go at adding async support myself, but before I spend a load of time on that I’m interested in some feedback on the solution:
Is this the right way to do this? It keeps SQL timings but loses any other steps.
There is an AddProfilerResults
extension method that says:
Adds externalProfiler Timing hierarchy
to this profiler’s current Timing
step, allowing other threads, remote
calls, etc. to be profiled and joined
into this profiling session.
But that doesn’t seem to work at the moment - is this something that’s already been started on by someone else?
Are there any major risks with my approach?