Table of Contents

Sample: IntroJitStatsDiagnoser

This diagnoser shows various stats from the JIT compiler that were collected during entire benchmark run (warmup phase and BenchmarkDotNet-generated boilerplate code are included):

  • Amount of JITted methods.
  • Amount of tiered methods.
  • How much memory JIT allocated during the benchmark.

Restrictions

  • Windows only

Source code

using System.Threading;
using BenchmarkDotNet.Attributes;

namespace BenchmarkDotNet.Samples
{
    [Diagnostics.Windows.Configs.JitStatsDiagnoser]
    public class IntroJitStatsDiagnoser
    {
        [Benchmark]
        public void Sleep() => Thread.Sleep(10);
    }
}

Output

Method Mean Error StdDev Methods JITted Methods Tiered JIT allocated memory
Sleep 15.50 ms 0.052 ms 0.048 ms 1,102 214 221,736 B