1

Can we reduce the time for TrivialDurationThresholdMilliseconds using miniprofiler tool as this code is not showing any effects written inside global.asax.cs

private void StartProfiler()

    {
       MiniProfiler.Start();
       MiniProfiler.Settings.TrivialDurationThresholdMilliseconds = 0.01M;
    }

and calling StartProfiler() method inside Application_BeginRequest

Sneha Rani
  • 11
  • 1
  • 3
  • In the source code, the term "TrivialDurationThresholdMilliseconds" only appears in its definition and it is never used. – burkay Dec 25 '17 at 18:09

1 Answers1

0

As Burkay mentioned in his comment, the TrivialDurationThresholdMilliseconds setting does not appear to be used; so requests of less than 20ms should be recorded and displayed.

If you want to limit only record requests within a range of times you could implement something like this (typically in the Application_EndRequest method of the global.asax.cs)

if (MiniProfiler.Current != null)
{
    decimal minimumMillisecondsToRecord = 0.1m;
    decimal maximumMillisecondsToRecord = 5.1m;

    var durationOfProfiling = DateTime.Now.ToUniversalTime() - MiniProfiler.Current.Started;
    if (durationOfProfiling.Milliseconds >= minimumMillisecondsToRecord
        && durationOfProfiling.Milliseconds <= maximumMillisecondsToRecord)
    {
        MiniProfiler.Stop(discardResults: false);
    }
    else
    {
        MiniProfiler.Stop(discardResults: true);
    }
}
KevD
  • 697
  • 9
  • 17