Files
Umbraco-CMS/tests/Umbraco.Tests.Benchmarks/Config/QuickRunConfigAttribute.cs
Paul Johnson 00133e880d Move test projects from src/ to tests/ (#11357)
* Update gitignore

* Move csproj

* Update project references

* Update solutions

* Update build scripts

* Tests used to share editorconfig with projects in src

* Fix broken tests.

* Stop copying around .editorconfig

merged root one with linting

* csharp_style_expression_bodied -> suggestion

* Move StyleCop rulesets to matching directories and update shared build properties

* Remove legacy build files, update NuGet.cofig and solution files

* Restore myget source

* Clean up .gitignore

* Update .gitignore

* Move new test classes to tests after merge

* Gitignore + nuget config

* Move new test

Co-authored-by: Ronald Barendse <ronald@barend.se>
2021-10-18 08:14:04 +01:00

35 lines
1.2 KiB
C#

using System;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using Perfolizer.Horology;
namespace Umbraco.Tests.Benchmarks.Config
{
/// <summary>
/// Configures the benchmark to run with less warmup and a shorter iteration time than the standard benchmark.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class QuickRunConfigAttribute : Attribute, IConfigSource
{
/// <summary>
/// Initializes a new instance of the <see cref="QuickRunConfigAttribute"/> class.
/// </summary>
public QuickRunConfigAttribute()
{
this.Config = (ManualConfig)ManualConfig.CreateEmpty()
.With(Job.Default.WithLaunchCount(1) // benchmark process will be launched only once
.WithIterationTime(new TimeInterval(100, TimeUnit.Millisecond)) // 100ms per iteration
.WithWarmupCount(3) // 3 warmup iteration
.WithIterationCount(3)); // 3 target iteration
}
/// <summary>
/// Gets the manual configuration.
/// </summary>
protected ManualConfig Config { get; }
/// <inheritdoc/>
IConfig IConfigSource.Config => this.Config;
}
}