mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
shorter writing of benchmark setup (#2063)
This commit is contained in:
parent
346cb75d43
commit
aa6ebd68e5
2 changed files with 29 additions and 5 deletions
|
|
@ -2,11 +2,37 @@
|
|||
// See LICENSE in the project root for license information.
|
||||
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Exporters.Csv;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
using BenchmarkDotNet.Reports;
|
||||
using Perfolizer.Horology;
|
||||
using Perfolizer.Metrology;
|
||||
|
||||
namespace Bff.Benchmarks;
|
||||
|
||||
[ShortRunJob]
|
||||
[Config(typeof(BenchmarkConfig))]
|
||||
public class BenchmarkBase
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class BenchmarkConfig : ManualConfig
|
||||
{
|
||||
public BenchmarkConfig()
|
||||
{
|
||||
var exporter = new CsvExporter(
|
||||
CsvSeparator.CurrentCulture,
|
||||
new SummaryStyle(
|
||||
cultureInfo: System.Globalization.CultureInfo.InvariantCulture,
|
||||
printUnitsInHeader: false,
|
||||
printUnitsInContent: false,
|
||||
timeUnit: TimeUnit.Microsecond,
|
||||
sizeUnit: SizeUnit.KB
|
||||
));
|
||||
|
||||
AddJob(Job.ShortRun);
|
||||
|
||||
AddExporter(exporter);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
||||
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args) => BenchmarkRunner.Run(typeof(Program).Assembly);
|
||||
}
|
||||
BenchmarkRunner.Run(typeof(Program).Assembly, ManualConfig.CreateMinimumViable());
|
||||
|
|
|
|||
Loading…
Reference in a new issue