EasyProfile 1.0.1

dotnet add package EasyProfile --version 1.0.1
                    
NuGet\Install-Package EasyProfile -Version 1.0.1
                    
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="EasyProfile" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasyProfile" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="EasyProfile" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasyProfile --version 1.0.1
                    
#r "nuget: EasyProfile, 1.0.1"
                    
#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.
#:package EasyProfile@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasyProfile&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=EasyProfile&version=1.0.1
                    
Install as a Cake Tool

Presentation

EasyProfile is a cross-platform profiler using .NET Standard 2.0. It runs anywhere you have C# installed. It provides a simple way to profile your code without having to pay for a version of Visual Studio with a .NET profiler. You can use it in two different ways. You can either write the code to profile in a using block or between a Start() and Stop() function.

using version:

using
{
    //Code to profile
}

Start() and Stop() version:

Start();
//Code to profile
Stop();

If you encouter a bug or want to request a feature, please open an issue in the githuh repo at https://github.com/DridriLaBastos/EasyProfile

The profiler also comes with two modes: a dynamic mode and a static mode.

Dynamic mode

In the dynamic mode, EasyProfile automatically updates to the Console the statistics of utilisation.

Static mode

In the static mode, you'll have to call a function when your done profiling your code. The data will be written to a file in a format that makes it possible to be view in any chromium browser. You'll simply have to type chrome://tracing and load the json file generated

Warning: the static mode is still in development, only the dynamic mode works at the moment

How To use

The profiler automatically creates the dependency tree to know in which section it is called. The dependency tree is built the first time of the execution adding a bit of overhead. But after this first building step, the profiler becomes low overhead.

Dynamic mode

You can profile your code and having results displayed at regular intervals using either of the two methods:

using (EasyProfile.Profiler.DynamicProfile("Section1 Name"))
{
    /*
        code to profile
    */
}
EasyProfile.Profiler.DynamicStart("Section1 Name");
/*
    code to profile
*/
EasyProfile.Profiler.Stop();

The difference between the two methods is that with the using, the profiler automatically stops if a return happens in the using block. With the Start and Stop method you'll have to be sure that for each Start call, a Stop call is made for each path in the profiled code.

By default, the statistics are displayed on the console each second. You can change this behaviour by calling

EasyProfile.Profiler.DynamicTimeInterval = /*time in second (integer)*/

Nested sections can be created. While in a using block or after a Start call without encountering a Stop call, the profiler will create a new section as a child of the current one and they will be indented in the display in the console.

For exemple, this code

void ProcessAudioData()
{
    using (EasyProfile.Profiler.DynamicProfile("FFT"))
    {
        PerformFFT(/*...*/);
    }
}
//...
using (EasyProfile.Profiler.DynamicProfile("Read Audio Data"))
{
    ReadAudio(/*...*/)
}

//...

using (EasyProfile.Profiler.DynamicProfile("Process Audio Data"))
{
    ProcessAudioData(/*...*/);
}
//...

Will display:

Dynamic Exemple

The format of the display is as follow:

<section name>: <call number> in <total ms time>ms (<time / call>)
    <section name>: <call number> in <total ms time>ms (<time / call> - <% of parent section if any>)

Documentation is still in progress

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

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.1 480 5/29/2021
1.0.0 385 5/26/2021