akanse.PathBench
1.0.0
dotnet add package akanse.PathBench --version 1.0.0
NuGet\Install-Package akanse.PathBench -Version 1.0.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.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="akanse.PathBench" Version="1.0.0" />
<PackageReference Include="akanse.PathBench" />
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.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: akanse.PathBench, 1.0.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.0.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.0.0
#tool nuget:?package=akanse.PathBench&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PathBench
Code path performance monitoring tool.
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
- Installation: Add PathBench to your project from NuGet.
- Code changes
- Create a
CodePathCounterinstance in the class that contains the method you want to monitor. - At the beginning of the monitored method, call
counter.StartMeasurement()to create a measurement instance and start the measurement. - Dispose the measurement instance to end the measurement.
- Call the
CreateProfileReports()method on theCodePathCounterinstance to produce measurement report instances. - Pass the measurement report instances to an appropriate formatter to output the results.
- Create a
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);
}
}
Release Notes
v1.0.0
- First release
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.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.0 | 84 | 2/17/2026 |