2

我正在使用一个 MVC 3 应用程序,它使用包含响应中计时的业务逻辑。现在我想将这些时间添加到我的 MVC3 应用程序中的 Mini-Profiler 中的特定级别。

我试过这样:

profiler.StepStart("key", "value");
var response = GetXXXResponse(request);
if (response != null && response.Timings)
{
    foreach (var child in response.Timings)
    {
         var profiler = new MiniProfiler(child.Name, _profilerService.Profiler.Level;
          profiler.ClientTimings = new ClientTimings { Timings = new List<ClientTimings.ClientTiming> { new ClientTimings.ClientTiming { Duration = child.ResponseTime, Name = child.Name, Start = 0 } } };
           _profilerService.Profiler.AddProfilerResults(profiler);
     }
}
profiler.StepStop("key");

我使用的是 Mini-Profiler 2.0.2 版,在 UI 中我看到了正在添加的步骤,但时间不正确。如何在 MVC 中分析特定功能并为无法更改的外部进程提供的该块添加额外的计时信息?

4

0 回答 0