Skip to content

teddymacn/CoreProfiler

Repository files navigation

CoreProfiler

CoreProfiler is a light weight performance profiling library for .NET Core. (Supports .Net Core 2.0 since v1.1)

CoreProfiler is a port of NanoProfiler by the same author of NanoProfiler.

The same as NanoProfiler, for web application, CoreProfiler provides a wonderful view-result Web UI supports view latest profiling results in a tree-timeline view (simply visit ~/coreprofiler/view in your web application).

For documentations of NanoProfiler, please check out wiki pages: https://github.com/englishtown/nanoprofiler/wiki

How to compile the source code?

License terms

CoreProfiler is released under the MIT license.

Basic usage

  • For profiling a web applications, you need to add references to both CoreProfiler and CoreProfiler.Web packages.

  • For profiling a console or web application which call wcf services, please also reference Console.Wcf package.

    To enable wcf profiling in a .net core project, you need to implement the partial method below for each of your wcf client:

    static partial void ConfigureEndpoint(ServiceEndpoint serviceEndpoint, ClientCredentials clientCredentials)
    {
        serviceEndpoint.EndpointBehaviors.Add(new WcfProfilingBehavior());
    }
  • In the Startup.cs file, you need to add the code below as the first app.UseXXX() pipeline to enable CoreProfiler profiling:

    app.UseCoreProfiler(drillDown:true); //if drillDown=true, try to drill down child requests from external apps when view profiling results

  • Add a coreprofiler.json file to your project and make sure it is copied to the output.

  • If you want to profile DB queries, you need to wrap DbConnection instances like for example: here.

  • In the coreprofiler.json file, you could configure some options of the profiling, including specifying custom configuration provider, log provider and persistence storage for persisting, profiling filters, number of profiling results to be kept in memory for display, etc.

You can check the mvc-ef-demo sample for how to enable profiling in a mvc + entityframeworkcore web application.

You can check the console-demo sample for how to use JsonProfilingStorage to persist logs and how to start/stop profiling in a non-web application.

Sample Projects

  • cross-app-profiling-demo - Sample projects to demonstrate cross-application performance profiling with coreprofiler/nanoprofiler.

About

A .NET Core Profiling Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages