Use this module to include profiling into your projects or modules. This module contains two separate projects and NuGet packages:
Unic.Profiling
: This is used for creating the profiling, add and stop profiling etc. in your code. This does actually nothing than firing some events.Unic.Profiling.MiniProfiler
: This takes the profiling events from the other project and forward them to the MiniProfiler. Use this project if you want to see an output of the profiling settings from the other project.
Install the NuGet package Unic.Profiling
on projects where you want to add a profiling.
Install the NuGet package Unic.Profiling.MiniProfiler
on web projects where you want to see the output of the configured profilings. After the installation you need to add the output directly before the closing </body>
tag the view:
@using StackExchange.Profiling;
<head>
...
</head>
<body>
...
@MiniProfiler.RenderIncludes()
</body>
To disable the MiniProfiler output, you can set the following config in the web.config
file. By default, MiniProfiler is enabled.
<configuration>
<appSettings>
<add key="Profiling.DisableMiniProfier" value="true" />
</appSettings>
</configuration>
For profiling your code, you just need to add a line of code each for starting and ending the profiling. It is important the event name is the same for starting and ending the profiling:
Unic.Profiling.Profiler.Profiler.OnStart(this, "My code");
...
Unic.Profiling.Profiler.Profiler.OnEnd(this, "My code");