dotnet / BenchmarkDotNet

Powerful .NET library for benchmarking
https://benchmarkdotnet.org
MIT License
10.47k stars 962 forks source link

How to change the time display mode from microseconds to seconds or milliseconds? #2544

Closed GooDgRaF closed 6 months ago

GooDgRaF commented 6 months ago

For example, I have the following part of the table from Benchmark. Could I change 'us' to 'ms' or 's'? image

Or, if the method took a long (not 'ns') time to run, then I should not use benchmarks and just use Stopwatch?

timcassell commented 6 months ago

It usually scales to the smallest result. You can force it to use whatever unit you want via summary style in the config. config.WithSummaryStyle(SummaryStyle.Default.WithTimeUnit(TimeUnit.<WhateverYouWant>))