akanse.PathBench 1.1.0

dotnet add package akanse.PathBench --version 1.1.0
                    
NuGet\Install-Package akanse.PathBench -Version 1.1.0
                    
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="akanse.PathBench" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="akanse.PathBench" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="akanse.PathBench" />
                    
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 akanse.PathBench --version 1.1.0
                    
#r "nuget: akanse.PathBench, 1.1.0"
                    
#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 akanse.PathBench@1.1.0
                    
#: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=akanse.PathBench&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=akanse.PathBench&version=1.1.0
                    
Install as a Cake Tool

PathBench

Code path performance monitoring tool.

<img src="https://img.shields.io/badge/-GitHub-blue.svg?logo=github" />

<img src="https://img.shields.io/badge/-NuGet-019733.svg?logo=nuget" />


Features

PathBench is a tool that measures method execution time to identify performance bottlenecks. It provides the following features:

  • Method execution time statistics: Measures method execution times and provides statistical information such as the mean, standard deviation, minimum, and maximum.
  • Checkpoint recording: Allows you to set checkpoints at arbitrary locations within a method and measure the execution time between checkpoints.
  • Result visualization: Outputs measurement results in Graphviz format and visualizes them as a directed graph between checkpoints.

Usage

  1. Installation: Add PathBench to your project from NuGet.
  2. Code changes
    1. Create a CodePathCounter instance in the class that contains the method you want to monitor.
    2. At the beginning of the monitored method, call counter.StartMeasurement() to create a measurement instance and start the measurement.
    3. Dispose the measurement instance to end the measurement.
    4. Call the CreateProfileReports() method on the CodePathCounter instance to produce measurement report instances.
    5. Pass the measurement report instances to an appropriate formatter to output the results.
using PathBench;

invokeTest();

static void invokeTest()
{
    for (var i = 0; i < 1000; ++i)
    {
        SampleClass.SimulatedWork(i);
    }

    var reports = SampleClass.Profiler.CreateProfileReports();
    var sw = new StringWriter();
    MethodProfileReportFormatter.DefaultGraphvizStyle.Format(
        reports[nameof(SampleClass.SimulatedWork)],
        writer: sw);
    Console.WriteLine(sw.ToString());
}

static class SampleClass
{
    public static readonly CodePathProfiler Profiler = CodePathProfiler.Create();

    public static void SimulatedWork(int seed)
    {
        using var counter = Profiler.StartMeasurement(argumentsExpressionProvider: $"seed={seed}");
        if (seed % 2 == 0)
        {
            counter.MarkCheckpoint("EvenSeed");
            Wait(2);
        }
        else
        {
            counter.MarkCheckpoint("OddSeed");
            Wait(0);
        }
        for (var i = 0; i < seed; ++i)
        {
            counter.MarkCheckpoint("LoopBegin", i);
            if (seed % 3 == 0)
            {
                counter.MarkCheckpoint("DivisibleBy3");
                Wait(3);
            }
            if (seed % 5 == 0)
            {
                counter.MarkCheckpoint("DivisibleBy5");
                Wait(5);
            }
            if (seed % 7 == 0)
            {
                counter.MarkCheckpoint("DivisibleBy7");
                Wait(7);
            }
            counter.MarkCheckpoint("LoopEnd");
        }
    }

    private static void Wait(int value)
    {
        Thread.SpinWait(value * 100);
    }
}

graphviz sample

Release Notes

v1.0.0

  • First release

v1.1.0

  • Adds support for net standard 2.0
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 is compatible.  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.

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.1.0 105 6/16/2026
1.0.0 128 2/17/2026