BenchmarkLiteLib 1.0.1

dotnet add package BenchmarkLiteLib --version 1.0.1                
NuGet\Install-Package BenchmarkLiteLib -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="BenchmarkLiteLib" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BenchmarkLiteLib --version 1.0.1                
#r "nuget: BenchmarkLiteLib, 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.
// Install BenchmarkLiteLib as a Cake Addin
#addin nuget:?package=BenchmarkLiteLib&version=1.0.1

// Install BenchmarkLiteLib as a Cake Tool
#tool nuget:?package=BenchmarkLiteLib&version=1.0.1                

A lightweight and simple benchmark tool.  This is a compiled version of BenchmarkLite.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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 1,670 12/2/2016
1.0.0 1,443 12/2/2016

Example:

   using System;
   using System.Threading;

   public class BenchmarkLiteDemo
   {
       public static void Run()
       {
           var oRandom = new Random();

           BenchmarkLite.Instance
               .Title("Benchmark 1")
               .Add(() =>
               {
                   Thread.Sleep(oRandom.Next(10));
               })
               .Add(() =>
               {
                   Thread.Sleep(oRandom.Next(10));
               })
               .Add((x) =>
               {
                   Console.Write($"{x}          \r");
                   Thread.Sleep(oRandom.Next(Math.Min(x, 10)));
               })
               .Add((x) =>
               {
                   Console.Write($"{x}          \r");
                   Thread.Sleep(oRandom.Next(Math.Min(x, 10)));
               })
               .Run(250, 1, Environment.ProcessorCount * 2 / 3)
               .ShowResults(false, true);

           BenchmarkLite.Instance.Reset();

           BenchmarkLite.Instance
               .Title("Benchmark 2")
               .Add(() =>
               {
                   Thread.Sleep(oRandom.Next(10));
               },
               () => { Console.WriteLine("Setup action 0"); },
               () => { Console.WriteLine("Cleanup action 0"); },
               "Action 0")
               .Add(() =>
               {
                   Thread.Sleep(oRandom.Next(10));
               })
               .Add((x) =>
               {
                   Console.Write($"{x}          \r");
                   Thread.Sleep(oRandom.Next(Math.Min(x, 10)));
               },
               () => { Console.WriteLine("Setup action 2"); },
               () => { Console.WriteLine("Cleanup action 2"); },
               "Action 2")
               .Add((x) =>
               {
                   Console.Write($"{x}          \r");
                   Thread.Sleep(oRandom.Next(Math.Min(x, 10)));
               })
               .Run(250, 1, Environment.ProcessorCount * 2 / 3)
               .ShowResults(true, true);

           Console.WriteLine("Press any key to continue");
           Console.ReadKey();
       }
   }

Output:

   --------------------------- Benchmark 1 ---------------------------
                                      Label  = Ave Sec    Percent Order
   [                                      0] =   0.295    100.94%     1
   [                                      1] =   0.304    104.04%     3
   [                                      2] =   0.302    103.10%     2
   [                                      3] =   0.293    100.00%     0

   Setup action 0
   Cleanup action 0
   Setup action 0
   Cleanup action 0
   Setup action 2
   Cleanup action 2
   Setup action 2
   Cleanup action 2
   --------------------------- Benchmark 2 ---------------------------
                                      Label  = Ave Sec    Percent Order
   [                               Action 0] =   0.298    100.00%     0
   [                                      1] =   0.299    100.33%     1
   [                               Action 2] =   0.306    102.41%     2
   [                                      3] =   0.310    104.06%     3

   Press any key to continue