Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Glimpse manual profiling a la MiniProfiler?

I'm looking into runtime profiling tools for a (WebForms) web app.

I have considered MiniProfiler and Glimpse.

In MiniProfiler it's easy (actually, the only way?) to log profiling messages:

var profiler = MiniProfiler.Current;
using (profiler.Step("Doing complex stuff"))
{
    using (profiler.Step("Step A"))
    { // something more interesting here
        Thread.Sleep(100);
    }
    using (profiler.Step("Step B"))
    { // and here
        Thread.Sleep(250);
    }
}

In Glimpse, you get automatic profiling for the request lifecycle -- but I'm not sure what's the easiest way to profile custom business logic scenarios.

I read here that Glimpse supports System.Diagnostics.(Trace|Debug).Trace*() in its 'Trace' tab, but that only shoows points in time, it doesn't seem to profile nested scopes. It would be nice to be able to trace custom data in a more structured way - for instance in the 'Timeline' tab.

So the question is, can I (hopefully easily) get MiniProfiler-like structured, custom logging in Glimpse?

PS. I know there's a Glimpse extension to display MiniProfiler data, but it looks like it's abandoned.

PPS. I was pleasantly surprised to see Glimpse work (almost) out of the box in my WebForms project (in IIS classic pipeline mode!). AFAIK, MiniProfiler doesn't play very nice with that configuration, it's skewed towards MVC.

like image 448
Cristian Diaconescu Avatar asked Oct 20 '22 20:10

Cristian Diaconescu


1 Answers

Unfortunately, Glimpse, as of version 1.8.6 (of the core package) does not support this.

Technically your could easily write an extension that does this, but its such a common request that we are adding it in to the next release. It's actually already documented at http://getglimpse.com/Docs/Timeline-Tab.

You could also just grab the code or GlimpseTimeline from our GitHub repo and get it working in the current version to fit your needs.

like image 152
nikmd23 Avatar answered Oct 22 '22 21:10

nikmd23