Table of Contents

Sample: IntroMultimodal

Source code

using System;
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;

namespace BenchmarkDotNet.Samples
{
    [MValueColumn]
    [SimpleJob(RunStrategy.Throughput, 1, 0, -1, 1, "MyJob")]
    public class IntroMultimodal
    {
        private readonly Random rnd = new Random(42);

        private void Multimodal(int n)
            => Thread.Sleep((rnd.Next(n) + 1) * 100);

        [Benchmark] public void Unimodal() => Multimodal(1);
        [Benchmark] public void Bimodal() => Multimodal(2);
        [Benchmark] public void Trimodal() => Multimodal(3);
        [Benchmark] public void Quadrimodal() => Multimodal(4);
    }
}

Output

      Method |     Mean |      Error |      StdDev |   Median | MValue |
------------ |---------:|-----------:|------------:|---------:|-------:|
    Unimodal | 100.5 ms |  0.0713 ms |   0.0667 ms | 100.5 ms |  2.000 |
     Bimodal | 144.5 ms | 16.9165 ms |  49.8787 ms | 100.6 ms |  3.571 |
    Trimodal | 182.5 ms | 27.4285 ms |  80.8734 ms | 200.5 ms |  4.651 |
 Quadrimodal | 226.6 ms | 37.2269 ms | 109.7644 ms | 200.7 ms |  5.882 |

// * Warnings *
MultimodalDistribution
  IntroMultimodal.Bimodal: MainJob     -> It seems that the distribution is bimodal (mValue = 3.57)
  IntroMultimodal.Trimodal: MainJob    -> It seems that the distribution is multimodal (mValue = 4.65)
  IntroMultimodal.Quadrimodal: MainJob -> It seems that the distribution is multimodal (mValue = 5.88)