SimpleXLProfiler 1.0.4

dotnet add package SimpleXLProfiler --version 1.0.4
NuGet\Install-Package SimpleXLProfiler -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleXLProfiler" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleXLProfiler --version 1.0.4
#r "nuget: SimpleXLProfiler, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SimpleXLProfiler as a Cake Addin
#addin nuget:?package=SimpleXLProfiler&version=1.0.4

// Install SimpleXLProfiler as a Cake Tool
#tool nuget:?package=SimpleXLProfiler&version=1.0.4

SimpleXLProfiler

What is SimpleXLProfiler for?

It is a very lightweight tool that produces an excel file while monitoring pieces of code associated with a description. It's basically a wrapper on System.Diagnostic.Stopwatch who write results using ClosedXML. If you want to learn further more, take a look at the source code.

Install SimpleXLProfiler via NuGet

If you want to include SimpleXLProfiler in your project, you can install it directly from NuGet

To install SimpleXLProfiler, run the following command in the Package Manager Console

PM> Install-Package SimpleXLProfiler

After installation, just add those two lines to your AppSettings with the values that suit you.

<add key="SimpleXLProfiler.FilePath" value="C:\profile\profile.xlsx"/>
<add key="SimpleXLProfiler.WorksheetTitle" value="Profiling Results"/>

How to use it

In the method you want to profile, just wrap the code with loggers as this:

using (var profiler = XLProfilerWriter.Instance)
{
    var logger = profiler.StartProfiling("do complex things is so long");
    _someService.DoComplexThings();
    _anotherService.DoEvenMoreComplexThings();
    logger.LogToXL();

    logger = profiler.StartProfiling("create documents with style");
    _documentServices.DoMagic();
    logger.LogToXL();        
}

and for subroutines, just use the instance with indentation (level) as the second parameter

var logger = XLProfilerWriter.Instance.StartProfiling("profile some code", 2)
// some code
logger.LogToXL();

the .xlsx document will be created (or updated if it' already there) at disposing time. (ie. the end of the using)

Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 634 3/28/2019