C
C#6mo ago
gonk

Measuring sub-millisecond execution time with Methodtimer.Fody

I am using https://github.com/Fody/MethodTimer to measure code execution time. The function I am trying to measure runs in under one millisecond, but MethodTimer only displays the amount of milliseconds. Is there a way to make MethodTimer display time in microseconds? Is there a different, easy-to-use benchmarking tool I could use?
GitHub
GitHub - Fody/MethodTimer: Injects some very basic method timing code.
Injects some very basic method timing code. Contribute to Fody/MethodTimer development by creating an account on GitHub.
2 Replies
cap5lut
cap5lut6mo ago
https://github.com/dotnet/BenchmarkDotNet is the defacto standard for benchmarks in the dotnet ecosystem for example because it ensures that the methods are T1 compiled (the JIT compiler that compiles the IL to machine code at runtime does it in multiple steps unoptimized -> unoptimized + instrumented -> optimized -- ofc this is a bit more complex than this, but at the end its currently tier 1)
gonk
gonk6mo ago
Looks good, thanks for the help.