This commit is contained in:
Andrey Akinshin 2020-03-12 12:24:54 +03:00
Родитель c3286f8306
Коммит 3223c94a92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 0F88A0476EF217EF
131 изменённых файлов: 310 добавлений и 297 удалений

Просмотреть файл

@ -6,6 +6,7 @@
<Rule Id="CA1028" Action="None" /> <!-- Enum storage should be Int32 -->
<Rule Id="CA1030" Action="None" /> <!-- Use events where appropriate -->
<Rule Id="CA1031" Action="None" /> <!-- Do not catch general exception types -->
<Rule Id="CA1032" Action="None" /> <!-- Implement standard exception constructors -->
<Rule Id="CA1034" Action="None" /> <!-- Nested types should not be visible -->
<Rule Id="CA1036" Action="None" /> <!-- Overload comparison operators when implementing System.IComparable -->
<Rule Id="CA1043" Action="None" /> <!-- Use integral or string argument for indexers -->
@ -18,6 +19,7 @@
<Rule Id="CA1058" Action="None" /> <!-- Types should not extend certain base types -->
<Rule Id="CA1061" Action="None" /> <!-- Do not hide base class methods -->
<Rule Id="CA1062" Action="None" /> <!-- Validate arguments of public methods -->
<Rule Id="CA1063" Action="None" /> <!-- Implement IDisposable correctly -->
<Rule Id="CA1064" Action="None" /> <!-- Exceptions should be public -->
<Rule Id="CA1065" Action="None" /> <!-- Do not raise exceptions in unexpected locations -->
<Rule Id="CA1066" Action="None" /> <!-- Type should implement IEquatable -->
@ -37,8 +39,10 @@
<Rule Id="CA1717" Action="None" /> <!-- Only FlagsAttribute enums should have plural names -->
<Rule Id="CA1720" Action="None" /> <!-- Identifier contains type name -->
<Rule Id="CA1721" Action="None" /> <!-- Property names should not match get methods -->
<Rule Id="CA1724" Action="None" /> <!-- Type names should not match namespaces -->
<Rule Id="CA1801" Action="None" /> <!-- Review unused parameters -->
<Rule Id="CA1806" Action="None" /> <!-- Do not ignore method results -->
<Rule Id="CA1810" Action="None" /> <!-- Initialize reference type static fields inline -->
<Rule Id="CA1812" Action="None" /> <!-- Avoid uninstantiated internal classes -->
<Rule Id="CA1814" Action="None" /> <!-- Prefer jagged arrays over multidimensional -->
<Rule Id="CA1815" Action="None" /> <!-- Override equals and operator equals on value types -->
@ -46,6 +50,10 @@
<Rule Id="CA1819" Action="None" /> <!-- Properties should not return arrays -->
<Rule Id="CA1820" Action="None" /> <!-- Test for empty strings using string length -->
<Rule Id="CA1822" Action="None" /> <!-- Mark members as static -->
<Rule Id="CA1826" Action="None" /> <!-- Do not use Enumerable methods on indexable collections. Instead use the collection directly -->
<Rule Id="CA2208" Action="None" /> <!-- Instantiate argument exceptions correctly -->
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
<Rule Id="CA2008" Action="None" /> <!-- Do not create tasks without passing a TaskScheduler -->
<Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
<Rule Id="CA2100" Action="None" /> <!-- Review SQL queries for security vulnerabilities -->
<Rule Id="CA2101" Action="None" /> <!-- Specify marshaling for P/Invoke string arguments -->
@ -89,6 +97,7 @@
<Rule Id="SA1110" Action="None" /> <!-- Opening parenthesis or bracket should be on declaration line -->
<Rule Id="SA1111" Action="None" /> <!-- Closing parenthesis should be on line of last parameter -->
<Rule Id="SA1114" Action="None" /> <!-- Parameter list should follow declaration -->
<Rule Id="SA1115" Action="None" /> <!-- The parameter should begin on the line after the previous parameter -->
<Rule Id="SA1116" Action="None" /> <!-- Split parameters should start on line after declaration -->
<Rule Id="SA1117" Action="None" /> <!-- Parameters should be on same line or separate lines -->
<Rule Id="SA1118" Action="None" /> <!-- Parameter should not span multiple lines -->
@ -115,6 +124,7 @@
<Rule Id="SA1202" Action="None" /> <!-- Elements should be ordered by access -->
<Rule Id="SA1203" Action="None" /> <!-- Constants should appear before fields -->
<Rule Id="SA1204" Action="None" /> <!-- Static elements should appear before instance elements -->
<Rule Id="SA1206" Action="None" /> <!-- The 'static' modifier should appear before 'new' -->
<Rule Id="SA1208" Action="None" /> <!-- Using directive ordering -->
<Rule Id="SA1209" Action="None" /> <!-- Using alias directives should be placed after all using namespace directives -->
<Rule Id="SA1210" Action="None" /> <!-- Using directives should be ordered alphabetically by the namespaces -->

Просмотреть файл

@ -11,6 +11,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<NoWarn>$(NoWarn);CA1018;CA5351</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
<Reference Include="System.Reflection" />

Просмотреть файл

@ -17,7 +17,7 @@ namespace BenchmarkDotNet.Samples
CultureInfo.NumberFormat.NumberDecimalSeparator = "@";
}
}
[Benchmark]
public void Foo() => Thread.Sleep(100);
}

Просмотреть файл

@ -36,6 +36,6 @@ namespace BenchmarkDotNet.Samples
ShouldGetInlined(); ShouldGetInlined(); ShouldGetInlined();
}
void ShouldGetInlined() { }
private void ShouldGetInlined() { }
}
}

Просмотреть файл

@ -6,7 +6,7 @@ namespace BenchmarkDotNet.Samples
[DisassemblyDiagnoser]
public class IntroDisassembly
{
int[] field = Enumerable.Range(0, 100).ToArray();
private int[] field = Enumerable.Range(0, 100).ToArray();
[Benchmark]
public int SumLocal()

Просмотреть файл

@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Samples
[RyuJitX64Job]
public class IntroDisassemblyRyuJit
{
int[] field = Enumerable.Range(0, 100).ToArray();
private int[] field = Enumerable.Range(0, 100).ToArray();
[Benchmark]
public int SumLocal()

Просмотреть файл

@ -2,7 +2,7 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
namespace BenchmarkDotNet.Samples
namespace BenchmarkDotNet.Samples
{
[ShortRunJob]
[EventPipeProfiler(EventPipeProfile.CpuSampling)]

Просмотреть файл

@ -1,10 +1,9 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using System.Runtime.CompilerServices;
namespace BenchmarkDotNet.Samples
{
[Diagnostics.Windows.Configs.InliningDiagnoser(logFailuresOnly: false, allowedNamespaces: new [] { "BenchmarkDotNet.Samples" })]
[Diagnostics.Windows.Configs.InliningDiagnoser(logFailuresOnly: false, allowedNamespaces: new[] { "BenchmarkDotNet.Samples" })]
public class IntroInliningDiagnoser
{
[Benchmark]

Просмотреть файл

@ -2,7 +2,6 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Mathematics.OutlierDetection;
namespace BenchmarkDotNet.Samples

Просмотреть файл

@ -1,7 +1,6 @@
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Mathematics.OutlierDetection;
namespace BenchmarkDotNet.Samples

Просмотреть файл

@ -2,8 +2,8 @@
namespace BenchmarkDotNet.Samples
{
class Program
public class Program
{
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}

Просмотреть файл

@ -16,8 +16,8 @@ namespace BenchmarkDotNet.Attributes
/// </summary>
public string Target
{
set => Targets = string.IsNullOrEmpty(value) ? new string[0] : value.Split(','); // , is for backward compat
get => throw new InvalidOperationException("Please use Targets property"); // kept to keep compiler happy "Named attribute arguments must be fields which are not readonly, static, or const, or read-write properties which are public and not static."
set => Targets = string.IsNullOrEmpty(value) ? new string[0] : value.Split(','); // , is for backward compat
}
public bool Match(MethodInfo method) => Targets == null || Targets.Length == 0 || Targets.Contains(method.Name);

Просмотреть файл

@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyTitle>Basic BenchmarkDotNet attributes that can be used to annotate your benchmarks</AssemblyTitle>
<TargetFrameworks>netstandard1.0;netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);1701;1702;1705;1591;3005;NU1702</NoWarn>
<NoWarn>$(NoWarn);1701;1702;1705;1591;3005;NU1702;CA1825</NoWarn>
<AssemblyName>BenchmarkDotNet.Annotations</AssemblyName>
<PackageId>BenchmarkDotNet.Annotations</PackageId>
<RootNamespace>BenchmarkDotNet</RootNamespace>

Просмотреть файл

@ -6,85 +6,105 @@ namespace BenchmarkDotNet.Jobs
/// the same Runtime as the host Process (default setting)
/// </summary>
HostProcess = 0,
/// <summary>
/// not recognized, possibly a new version of .NET Core
/// </summary>
NotRecognized,
/// <summary>
/// Mono
/// </summary>
Mono,
/// <summary>
/// .NET 4.6.1
/// </summary>
Net461,
/// <summary>
/// .NET 4.6.2
/// </summary>
Net462,
/// <summary>
/// .NET 4.7
/// </summary>
Net47,
/// <summary>
/// .NET 4.7.1
/// </summary>
Net471,
/// <summary>
/// .NET 4.7.2
/// </summary>
Net472,
/// <summary>
/// .NET 4.8
/// </summary>
Net48,
/// <summary>
/// .NET Core 2.0
/// </summary>
NetCoreApp20,
/// <summary>
/// .NET Core 2.1
/// </summary>
NetCoreApp21,
/// <summary>
/// .NET Core 2.2
/// </summary>
NetCoreApp22,
/// <summary>
/// .NET Core 3.0
/// </summary>
NetCoreApp30,
/// <summary>
/// .NET Core 3.1
/// </summary>
NetCoreApp31,
/// <summary>
/// .NET Core 5.0 aka ".NET 5"
/// </summary>
NetCoreApp50,
/// <summary>
/// CoreRT compiled as netcoreapp2.0
/// </summary>
CoreRt20,
/// <summary>
/// CoreRT compiled as netcoreapp2.1
/// </summary>
CoreRt21,
/// <summary>
/// CoreRT compiled as netcoreapp2.2
/// </summary>
CoreRt22,
/// <summary>
/// CoreRT compiled as netcoreapp3.0
/// </summary>
CoreRt30,
/// <summary>
/// CoreRT compiled as netcoreapp3.1
/// </summary>
CoreRt31,
/// <summary>
/// CoreRT compiled as netcoreapp5.0
/// </summary>
CoreRt50,
CoreRt50
}
}
}

Просмотреть файл

@ -5,6 +5,7 @@ using JetBrains.Annotations;
namespace BenchmarkDotNet.Diagnostics.Windows.Configs
{
[PublicAPI]
[AttributeUsage(AttributeTargets.Class)]
public class ConcurrencyVisualizerProfilerAttribute : Attribute, IConfigSource
{
public ConcurrencyVisualizerProfilerAttribute() => Config = ManualConfig.CreateEmpty().AddDiagnoser(new ConcurrencyVisualizerProfiler());

Просмотреть файл

@ -5,6 +5,7 @@ using JetBrains.Annotations;
namespace BenchmarkDotNet.Diagnostics.Windows.Configs
{
[PublicAPI]
[AttributeUsage(AttributeTargets.Class)]
public class EtwProfilerAttribute : Attribute, IConfigSource
{
/// <param name="performExtraBenchmarksRun">if set to true, benchmarks will be executed on more time with the profiler attached. If set to false, there will be no extra run but the results will contain overhead. True by default.</param>

Просмотреть файл

@ -3,6 +3,7 @@ using BenchmarkDotNet.Configs;
namespace BenchmarkDotNet.Diagnostics.Windows.Configs
{
[AttributeUsage(AttributeTargets.Class)]
public class InliningDiagnoserAttribute : Attribute, IConfigSource
{
/// <param name="logFailuresOnly">only the methods that failed to get inlined. True by default.</param>

Просмотреть файл

@ -3,6 +3,7 @@ using System;
namespace BenchmarkDotNet.Diagnostics.Windows.Configs
{
[AttributeUsage(AttributeTargets.Class)]
public class TailCallDiagnoserAttribute : Attribute, IConfigSource
{
public IConfig Config { get; }

Просмотреть файл

@ -43,7 +43,7 @@ namespace BenchmarkDotNet.Diagnostics.Windows
public string ShortName => "ETW";
public IEnumerable<string> Ids => new [] { nameof(EtwProfiler) };
public IEnumerable<string> Ids => new[] { nameof(EtwProfiler) };
public IEnumerable<IExporter> Exporters => Array.Empty<IExporter>();

Просмотреть файл

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using BenchmarkDotNet.Diagnosers;
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Parsers;

Просмотреть файл

@ -2,9 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Portability;
using BenchmarkDotNet.Toolchains.InProcess;
using BenchmarkDotNet.Toolchains.InProcess.Emit;
using BenchmarkDotNet.Validators;
using Microsoft.Diagnostics.Tracing.Session;

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Text;
using Microsoft.Diagnostics.Tracing;

Просмотреть файл

@ -1,9 +1,8 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
@ -13,6 +12,7 @@ using Address = System.UInt64;
namespace BenchmarkDotNet.Diagnostics.Windows.Tracing
{
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1121:UseBuiltInTypeAlias")]
public class NativeMemoryLogParser
{
private static readonly string LogSeparator = new string('-', 20);

Просмотреть файл

@ -111,7 +111,7 @@ namespace BenchmarkDotNet.Disassemblers
Map[] maps = settings.PrintSource
? codes.GroupBy(code => code.InstructionPointer).OrderBy(group => group.Key).Select(group => new Map() { SourceCodes = group.ToArray() }).ToArray()
: new [] { new Map() { SourceCodes = codes.ToArray() } };
: new[] { new Map() { SourceCodes = codes.ToArray() } };
return new DisassembledMethod
{

Просмотреть файл

@ -50,7 +50,7 @@ namespace BenchmarkDotNet.Disassemblers
public string Problem { get; set; }
public Map[] Maps { get; set; }
public string CommandLine { get; set; }
public static DisassembledMethod Empty(string fullSignature, ulong nativeCode, string problem)
@ -70,17 +70,17 @@ namespace BenchmarkDotNet.Disassemblers
public MutablePair[] SerializedAddressToNameMapping { get; set; }
public uint PointerSize { get; set; }
[XmlIgnore()] // XmlSerializer does not support dictionaries ;)
[XmlIgnore] // XmlSerializer does not support dictionaries ;)
public Dictionary<ulong, string> AddressToNameMapping
=> _addressToNameMapping ?? (_addressToNameMapping = SerializedAddressToNameMapping.ToDictionary(x => x.Key, x => x.Value));
[XmlIgnore()]
[XmlIgnore]
private Dictionary<ulong, string> _addressToNameMapping;
public DisassemblyResult()
{
Methods = new DisassembledMethod[0];
Errors = new string[0];
Methods = Array.Empty<DisassembledMethod>();
Errors = Array.Empty<string>();
}
// KeyValuePair is not serializable, because it has read-only properties

Просмотреть файл

@ -8,14 +8,14 @@ namespace BenchmarkDotNet.Disassemblers
{
internal static class Program
{
// the goals of the existence of this process:
// the goals of the existence of this process:
// 1. attach to benchmarked process
// 2. disassemble the code
// 3. save it to xml file
// 4. detach & shut down
//
// requirements: must not have any dependencies to BenchmarkDotNet itself, KISS
static void Main(string[] args)
public static void Main(string[] args)
{
var options = Settings.FromArgs(args);
@ -25,7 +25,7 @@ namespace BenchmarkDotNet.Disassemblers
try
{
var methodsToExport = ClrMdDisassembler.AttachAndDisassemble(options);
SaveToFile(methodsToExport, options.ResultsPath);
}
catch (OutOfMemoryException) // thrown by clrmd when pdb is missing or in invalid format

Просмотреть файл

@ -13,7 +13,7 @@ namespace BenchmarkDotNet.Tool
[Command(
Name = "benchmark",
Description = "A dotnet tool to execute benchmarks built with BenchmarkDotNet.")]
[HelpOption()]
[HelpOption]
[VersionOptionFromMember(MemberName = nameof(GetVersion))]
public sealed class Program
{

Просмотреть файл

@ -20,7 +20,7 @@ namespace BenchmarkDotNet.Analysers
.ToArray();
if (columns.IsEmpty())
yield break;
var columnNames = string.Join(", ", columns);
foreach (var benchmarkCase in summary.BenchmarksCases)

Просмотреть файл

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Globalization;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Reports;
using JetBrains.Annotations;
using Perfolizer.Mathematics.Multimodality;

Просмотреть файл

@ -53,6 +53,7 @@ namespace BenchmarkDotNet.Analysers
/// <param name="allOutliers">All outliers which present in the distribution (lower and upper)</param>
/// <param name="lowerOutliers">All lower outliers</param>
/// <param name="upperOutliers">All upper outliers</param>
/// <param name="cultureInfo">CultureInfo</param>
/// <returns>The message</returns>
[PublicAPI, NotNull, Pure]
public static string GetMessage(double[] actualOutliers, double[] allOutliers, double[] lowerOutliers, double[] upperOutliers, CultureInfo cultureInfo)
@ -83,7 +84,7 @@ namespace BenchmarkDotNet.Analysers
private static string GetRangeMessage([NotNull] double[] values, CultureInfo cultureInfo)
{
string Format(double value) => TimeInterval.FromNanoseconds(value).ToString(cultureInfo, "N2");
switch (values.Length) {
case 0:
return null;

Просмотреть файл

@ -18,4 +18,3 @@ namespace BenchmarkDotNet.Attributes
}
}
}

Просмотреть файл

@ -1,5 +1,4 @@
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Mathematics;
using JetBrains.Annotations;
using Perfolizer.Mathematics.Common;

Просмотреть файл

@ -8,7 +8,7 @@ using JetBrains.Annotations;
namespace BenchmarkDotNet.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
[Obsolete]
[Obsolete("Don't use it")]
public class EncodingAttribute : Attribute, IConfigSource
{
public IConfig Config { get; }

Просмотреть файл

@ -2,7 +2,7 @@ using System;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
namespace BenchmarkDotNet.Attributes
namespace BenchmarkDotNet.Attributes
{
[AttributeUsage(AttributeTargets.Class)]
public class EventPipeProfilerAttribute : Attribute, IConfigSource

Просмотреть файл

@ -1,5 +1,4 @@
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Mathematics.OutlierDetection;
namespace BenchmarkDotNet.Attributes

Просмотреть файл

@ -14,7 +14,7 @@ namespace BenchmarkDotNet.Attributes
{
Config = ManualConfig.CreateEmpty().AddLogger(ConsoleLogger.Unicode);
}
public IConfig Config { get; }
}
}

Просмотреть файл

@ -4,7 +4,7 @@
<AssemblyTitle>BenchmarkDotNet</AssemblyTitle>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);1701;1702;1705;1591;3005;NU1702</NoWarn>
<NoWarn>$(NoWarn);1701;1702;1705;1591;3005;NU1702;CS3001;CS3003</NoWarn>
<AssemblyName>BenchmarkDotNet</AssemblyName>
<PackageId>BenchmarkDotNet</PackageId>
<RootNamespace>BenchmarkDotNet</RootNamespace>

Просмотреть файл

@ -57,7 +57,7 @@ namespace BenchmarkDotNet.Code
var methodInfo = arrayParamType.GetMethod(nameof(ForPrimitives), BindingFlags.Public | BindingFlags.Static)
?? throw new InvalidOperationException($"{nameof(ForPrimitives)} not found");
return (IParam)methodInfo.Invoke(null, new []{ array});
return (IParam)methodInfo.Invoke(null, new[]{ array});
}
}
}

Просмотреть файл

@ -276,7 +276,7 @@ namespace BenchmarkDotNet.Code
private static Type GetFieldType(Type argumentType, ParameterInstance argument)
{
// #774 we can't store Span in a field, so we store an array (which is later casted to Span when we load the arguments)
if(argumentType.IsStackOnlyWithImplicitCast(argument.Value))
if (argumentType.IsStackOnlyWithImplicitCast(argument.Value))
return argument.Value.GetType();
return argumentType;

Просмотреть файл

@ -20,7 +20,7 @@ namespace BenchmarkDotNet.Columns
}
private const long BytesInKiloByte = 1024L; // this value MUST NOT be changed
public SizeValue ToValue(long value = 1) => new SizeValue(value, this);
[PublicAPI] public static readonly SizeUnit B = new SizeUnit("B", "Byte", 1L);

Просмотреть файл

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;

Просмотреть файл

@ -23,7 +23,7 @@ namespace BenchmarkDotNet.Configs
[Obsolete("This method will soon be removed, please start using .AddColumn() instead.")]
[EditorBrowsable(EditorBrowsableState.Never)] public static IConfig With(this IConfig config, params IColumn[] columns) => config.AddColumn(columns);
[PublicAPI] public static ManualConfig AddColumn(this IConfig config, params IColumn[] columns) => config.With(m => m.AddColumn(columns));
[Obsolete("This method will soon be removed, please start using .AddColumnProvider() instead.")]
[EditorBrowsable(EditorBrowsableState.Never)] public static IConfig With(this IConfig config, params IColumnProvider[] columnProviders) => config.AddColumnProvider(columnProviders);
[PublicAPI] public static ManualConfig AddColumnProvider(this IConfig config, params IColumnProvider[] columnProviders) => config.With(m => m.AddColumnProvider(columnProviders));
@ -74,7 +74,7 @@ namespace BenchmarkDotNet.Configs
[PublicAPI] public static ManualConfig WithArtifactsPath(this IConfig config, string artifactsPath) => config.With(m => m.WithArtifactsPath(artifactsPath));
[PublicAPI] public static ManualConfig WithUnionRule(this IConfig config, ConfigUnionRule unionRule) => config.With(m => m.WithUnionRule(unionRule));
[PublicAPI] public static ManualConfig WithCultureInfo(this IConfig config, CultureInfo cultureInfo) => config.With(m => m.CultureInfo = cultureInfo);
/// <summary>
/// determines if all auto-generated files should be kept or removed after running the benchmarks
/// </summary>
@ -96,17 +96,17 @@ namespace BenchmarkDotNet.Configs
/// </summary>
[Obsolete("This method will soon be removed, please start using .WithOptions() instead.")]
[EditorBrowsable(EditorBrowsableState.Never)] public static IConfig With(this IConfig config, ConfigOptions options) => config.WithOptions(options);
/// <summary>
/// sets given option to provided value
/// </summary>
[PublicAPI] public static ManualConfig WithOption(this IConfig config, ConfigOptions option, bool value) => config.With(m => m.WithOption(option, value));
/// <summary>
/// sets given options for the config
/// </summary>
[PublicAPI] public static ManualConfig WithOptions(this IConfig config, ConfigOptions options) => config.With(m => m.WithOptions(options));
[Obsolete("This method will soon be removed, please start using .AddLogicalGroupRules() instead.")]
[EditorBrowsable(EditorBrowsableState.Never)] public static IConfig With(this IConfig config, params BenchmarkLogicalGroupRule[] rules) => config.AddLogicalGroupRules(rules);
[PublicAPI] public static ManualConfig AddLogicalGroupRules(this IConfig config, params BenchmarkLogicalGroupRule[] rules) => config.With(c => c.AddLogicalGroupRules(rules));

Просмотреть файл

@ -54,7 +54,7 @@ namespace BenchmarkDotNet.Configs
Options = Options.Set(value, option);
return this;
}
public ManualConfig WithOptions(ConfigOptions options)
{
Options |= options;
@ -168,7 +168,7 @@ namespace BenchmarkDotNet.Configs
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using ..AddHardwareCounters()() instead.")]
public void Add(params HardwareCounter[] newHardwareCounters) => AddHardwareCounters(newHardwareCounters);
public ManualConfig AddHardwareCounters(params HardwareCounter[] newHardwareCounters)
{
hardwareCounters.AddRange(newHardwareCounters);
@ -178,7 +178,7 @@ namespace BenchmarkDotNet.Configs
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using .AddFilter() instead.")]
public void Add(params IFilter[] newFilters) => AddFilter(newFilters);
public ManualConfig AddFilter(params IFilter[] newFilters)
{
filters.AddRange(newFilters);
@ -188,7 +188,7 @@ namespace BenchmarkDotNet.Configs
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using .AddLogicalGroupRules() instead.")]
public void Add(params BenchmarkLogicalGroupRule[] rules) => AddLogicalGroupRules(rules);
public ManualConfig AddLogicalGroupRules(params BenchmarkLogicalGroupRule[] rules)
{
logicalGroupRules.AddRange(rules);

Просмотреть файл

@ -6,7 +6,6 @@ using BenchmarkDotNet.ConsoleArguments.ListBenchmarks;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Mathematics;
using CommandLine;
using CommandLine.Text;
using JetBrains.Annotations;
@ -182,7 +181,7 @@ namespace BenchmarkDotNet.ConsoleArguments
yield return new Example("Run benchmarks for .NET Core 2.0, .NET Core 2.1 and .NET Core 2.2. .NET Core 2.0 will be baseline because it was first.", longName, new CommandLineOptions { Runtimes = new[] { "netcoreapp2.0", "netcoreapp2.1", "netcoreapp2.2" } });
yield return new Example("Use MemoryDiagnoser to get GC stats", shortName, new CommandLineOptions { UseMemoryDiagnoser = true });
yield return new Example("Use DisassemblyDiagnoser to get disassembly", shortName, new CommandLineOptions { UseDisassemblyDiagnoser = true });
yield return new Example("Use HardwareCountersDiagnoser to get hardware counter info", longName, new CommandLineOptions { HardwareCounters = new [] { nameof(HardwareCounter.CacheMisses), nameof(HardwareCounter.InstructionRetired) } });
yield return new Example("Use HardwareCountersDiagnoser to get hardware counter info", longName, new CommandLineOptions { HardwareCounters = new[] { nameof(HardwareCounter.CacheMisses), nameof(HardwareCounter.InstructionRetired) } });
yield return new Example("Run all benchmarks exactly once", shortName, new CommandLineOptions { BaseJob = "Dry", Filters = new[] { Escape("*") } });
yield return new Example("Run all benchmarks from System.Memory namespace", shortName, new CommandLineOptions { Filters = new[] { Escape("System.Memory*") } });
yield return new Example("Run all benchmarks from ClassA and ClassB using type names", shortName, new CommandLineOptions { Filters = new[] { "ClassA", "ClassB" } });
@ -192,8 +191,8 @@ namespace BenchmarkDotNet.ConsoleArguments
yield return new Example("Run selected benchmarks 100 times per iteration. Perform single warmup iteration and 5 actual workload iterations", longName, new CommandLineOptions { InvocationCount = 100, WarmupIterationCount = 1, IterationCount = 5});
yield return new Example("Run selected benchmarks 250ms per iteration. Perform from 9 to 15 iterations", longName, new CommandLineOptions { IterationTimeInMilliseconds = 250, MinIterationCount = 9, MaxIterationCount = 15});
yield return new Example("Run MannWhitney test with relative ratio of 5% for all benchmarks for .NET Core 2.0 (base) vs .NET Core 2.1 (diff). .NET Core 2.0 will be baseline because it was provided as first.", longName,
new CommandLineOptions { Filters = new [] { "*"}, Runtimes = new[] { "netcoreapp2.0", "netcoreapp2.1" }, StatisticalTestThreshold = "5%" });
yield return new Example("Run benchmarks using environment variables 'ENV_VAR_KEY_1' with value 'value_1' and 'ENV_VAR_KEY_2' with value 'value_2'", longName,
new CommandLineOptions { Filters = new[] { "*"}, Runtimes = new[] { "netcoreapp2.0", "netcoreapp2.1" }, StatisticalTestThreshold = "5%" });
yield return new Example("Run benchmarks using environment variables 'ENV_VAR_KEY_1' with value 'value_1' and 'ENV_VAR_KEY_2' with value 'value_2'", longName,
new CommandLineOptions { EnvironmentVariables = new[] { "ENV_VAR_KEY_1:value_1", "ENV_VAR_KEY_2:value_2" } });
}
}

Просмотреть файл

@ -15,7 +15,6 @@ using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Filters;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Portability;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Toolchains.CoreRt;
@ -270,7 +269,7 @@ namespace BenchmarkDotNet.ConsoleArguments
{
baseJob = baseJob.WithEnvironmentVariables(options.EnvironmentVariables.Select(text =>
{
var separated = text.Split(new [] { EnvVarKeyValueSeparator }, 2);
var separated = text.Split(new[] { EnvVarKeyValueSeparator }, 2);
return new EnvironmentVariable(separated[0], separated[1]);
}).ToArray());
}

Просмотреть файл

@ -1,4 +1,4 @@
namespace BenchmarkDotNet.Diagnosers
namespace BenchmarkDotNet.Diagnosers
{
public enum EventPipeProfile
{

Просмотреть файл

@ -131,7 +131,7 @@ namespace BenchmarkDotNet.Diagnosers
private static bool ShouldUseWindowsDisassembler(BenchmarkCase benchmarkCase)
=> !(benchmarkCase.Job.Environment.Runtime is MonoRuntime) && RuntimeInformation.IsWindows();
private static bool ShouldUseLinuxDisassembler(BenchmarkCase benchmarkCase)
=> !(benchmarkCase.Job.Environment.Runtime is MonoRuntime) && RuntimeInformation.IsLinux();

Просмотреть файл

@ -62,7 +62,7 @@ namespace BenchmarkDotNet.Diagnosers
{
var symbolSolver = new SymbolResolver(addressToNameMapping);
switch(Formatter)
switch (Formatter)
{
case MasmFormatter masmFormatter:
return new MasmFormatter(masmFormatter.MasmOptions, symbolSolver);

Просмотреть файл

@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Disassemblers
{
internal static string Format(SourceCode sourceCode, Formatter formatter, bool printInstructionAddresses, uint pointerSize)
{
switch(sourceCode)
switch (sourceCode)
{
case Asm asm:
return InstructionFormatter.Format(asm.Instruction, formatter, printInstructionAddresses, pointerSize);

Просмотреть файл

@ -8,7 +8,7 @@ namespace BenchmarkDotNet.Disassemblers
internal LinuxDisassembler(DisassemblyDiagnoserConfig config) => this.config = config;
internal DisassemblyResult Disassemble(DiagnoserActionParameters parameters)
internal DisassemblyResult Disassemble(DiagnoserActionParameters parameters)
=> ClrMdDisassembler.AttachAndDisassemble(BuildDisassemblerSettings(parameters));
private Settings BuildDisassemblerSettings(DiagnoserActionParameters parameters)

Просмотреть файл

@ -125,8 +125,8 @@ namespace BenchmarkDotNet.Disassemblers
};
}
//line example 1: 0: 48 83 ec 28 sub $0x28,%rsp
//line example 2: 0000000000000000 subq $0x28, %rsp
//line example 1: 0: 48 83 ec 28 sub $0x28,%rsp
//line example 2: 0000000000000000 subq $0x28, %rsp
private static readonly Regex InstructionRegex = new Regex(@"\s*(?<address>[0-9a-f]+)(\:\s+([0-9a-f]{2}\s+)+)?\s+(?<instruction>.*)\s*", RegexOptions.Compiled);
private static bool TryParseInstruction(string line, out MonoCode instruction)

Просмотреть файл

@ -30,7 +30,7 @@ namespace BenchmarkDotNet.Engines
// I did not use Mutexes because they are not supported for Linux/MacOs for .NET Core
// this solution is stupid simple and it works
string acknowledgment = inReader.ReadLine();
if(acknowledgment != Engine.Signals.Acknowledgment)
if (acknowledgment != Engine.Signals.Acknowledgment)
throw new NotSupportedException($"Unknown Acknowledgment: {acknowledgment}");
}

Просмотреть файл

@ -148,7 +148,7 @@ namespace BenchmarkDotNet.Engines
bool isOverhead = data.IterationMode == IterationMode.Overhead;
var action = isOverhead ? OverheadAction : WorkloadAction;
if(!isOverhead)
if (!isOverhead)
IterationSetupAction();
GcCollect();
@ -164,7 +164,7 @@ namespace BenchmarkDotNet.Engines
if (EngineEventSource.Log.IsEnabled())
EngineEventSource.Log.IterationStop(data.IterationMode, data.IterationStage, totalOperations);
if(!isOverhead)
if (!isOverhead)
IterationCleanupAction();
GcCollect();

Просмотреть файл

@ -22,7 +22,7 @@ namespace BenchmarkDotNet.Engines
throw new ArgumentNullException(nameof(engineParameters.OverheadActionNoUnroll));
if (engineParameters.OverheadActionUnroll == null)
throw new ArgumentNullException(nameof(engineParameters.OverheadActionUnroll));
if(engineParameters.TargetJob == null)
if (engineParameters.TargetJob == null)
throw new ArgumentNullException(nameof(engineParameters.TargetJob));
engineParameters.GlobalSetupAction?.Invoke(); // whatever the settings are, we MUST call global setup here, the global cleanup is part of Engine's Dispose

Просмотреть файл

@ -1,7 +1,6 @@
using System;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Horology;
using Perfolizer.Mathematics.OutlierDetection;

Просмотреть файл

@ -175,7 +175,7 @@ namespace BenchmarkDotNet.Engines
public static GcStats Parse(string line)
{
if(!line.StartsWith(ResultsLinePrefix))
if (!line.StartsWith(ResultsLinePrefix))
throw new NotSupportedException($"Line must start with {ResultsLinePrefix}");
var measurementSplit = line.Remove(0, ResultsLinePrefix.Length).Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

Просмотреть файл

@ -8,8 +8,8 @@ namespace BenchmarkDotNet.Engines
internal const string ResultsLinePrefix = "Threading: ";
// BDN targets .NET Standard 2.0, these properties are not part of .NET Standard 2.0, were added in .NET Core 3.0
private static readonly Func<long> GetCompletedWorkItemCountDelegate = CreateGetterDelegate(typeof(ThreadPool), "CompletedWorkItemCount");
private static readonly Func<long> GetLockContentionCountDelegate = CreateGetterDelegate(typeof(Monitor), "LockContentionCount");
private static readonly Func<long> GetCompletedWorkItemCountDelegate = CreateGetterDelegate(typeof(ThreadPool), nameof(CompletedWorkItemCount));
private static readonly Func<long> GetLockContentionCountDelegate = CreateGetterDelegate(typeof(Monitor), nameof(LockContentionCount));
public static ThreadingStats Empty => new ThreadingStats(0, 0, 0);

Просмотреть файл

@ -17,7 +17,7 @@ namespace BenchmarkDotNet.Exporters
public void ExportToLog(Summary summary, ILogger logger)
{
if(summary.GetColumns().IsNullOrEmpty())
if (summary.GetColumns().IsNullOrEmpty())
logger.WriteLineHint("You haven't configured any columns, your results will be empty");
foreach (var exporter in exporters)

Просмотреть файл

@ -175,7 +175,7 @@ namespace BenchmarkDotNet.Exporters
logger.WriteLine("<body>");
logger.WriteLine("<!-- Generated with BenchmarkDotNet ");
foreach(var total in totals)
foreach (var total in totals)
{
// this stats are mostly for me, the maintainer, who wants to know if removing noise makes any sense
logger.WriteLine($"For {total.Key} we have {total.Value.total} in total, {total.Value.withoutNoise} without noise");

Просмотреть файл

@ -63,7 +63,7 @@ namespace BenchmarkDotNet.Exporters.Json
};
// We show MemoryDiagnoser's results only if it is being used
if(report.BenchmarkCase.Config.HasMemoryDiagnoser())
if (report.BenchmarkCase.Config.HasMemoryDiagnoser())
{
data.Add("Memory", report.GcStats);
}

Просмотреть файл

@ -41,7 +41,7 @@ namespace BenchmarkDotNet.Exporters
lock (BuildScriptLock)
File.WriteAllText(scriptFullPath, script);
if(!TryFindRScript(consoleLogger, out string rscriptPath))
if (!TryFindRScript(consoleLogger, out string rscriptPath))
{
yield break;
}

Просмотреть файл

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Attributes;

Просмотреть файл

@ -18,7 +18,7 @@ namespace BenchmarkDotNet.Extensions
var timeUnit = TimeUnit.GetBestTimeUnit(s.Mean);
return x => TimeInterval.FromNanoseconds(x).ToString(timeUnit, cultureInfo, format);
}
[PublicAPI]
public static string ToString(this Statistics s, CultureInfo cultureInfo, Func<double, string> formatter, bool calcHistogram = false)
{
@ -26,7 +26,7 @@ namespace BenchmarkDotNet.Extensions
return NullSummaryMessage;
string listSeparator = cultureInfo.GetActualListSeparator();
var builder = new StringBuilder();
string errorPercent = (s.StandardError / s.Mean * 100).ToString("0.00", cultureInfo);
var ci = s.ConfidenceInterval;
@ -48,7 +48,7 @@ namespace BenchmarkDotNet.Extensions
builder.Append(" StdDev = ");
builder.Append(formatter(s.StandardDeviation));
builder.AppendLine();
builder.Append("Min = ");
builder.Append(formatter(s.Min));
builder.Append(listSeparator);
@ -64,7 +64,7 @@ namespace BenchmarkDotNet.Extensions
builder.Append(" Max = ");
builder.Append(formatter(s.Max));
builder.AppendLine();
builder.Append("IQR = ");
builder.Append(formatter(s.InterquartileRange));
builder.Append(listSeparator);
@ -74,7 +74,7 @@ namespace BenchmarkDotNet.Extensions
builder.Append(" UpperFence = ");
builder.Append(formatter(s.UpperFence));
builder.AppendLine();
builder.Append("ConfidenceInterval = ");
builder.Append(s.ConfidenceInterval.ToString(formatter));
builder.Append(listSeparator);
@ -84,7 +84,7 @@ namespace BenchmarkDotNet.Extensions
builder.Append(ciMarginPercent);
builder.Append("% of Mean)");
builder.AppendLine();
builder.Append("Skewness = ");
builder.Append(s.Skewness.ToString("0.##", cultureInfo));
builder.Append(listSeparator);
@ -94,7 +94,7 @@ namespace BenchmarkDotNet.Extensions
builder.Append(" MValue = ");
builder.Append(mValue.ToString("0.##", cultureInfo));
builder.AppendLine();
if (calcHistogram)
{
var histogram = HistogramBuilder.Adaptive.Build(s.OriginalValues);

Просмотреть файл

@ -7,7 +7,7 @@ using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Toolchains;
namespace BenchmarkDotNet.Helpers
namespace BenchmarkDotNet.Helpers
{
internal static class ArtifactFileNameHelper
{

Просмотреть файл

@ -7,8 +7,8 @@ namespace BenchmarkDotNet.Helpers
/// <summary>
/// The 'μ' symbol
/// </summary>
private const string Mu = "\u03BC";
private const string Mu = "\u03BC";
public static string ToAscii([CanBeNull] this string s)
{
// We should replace all non-ASCII symbols that used in BenchmarkDotNet by ASCII-compatible analogues

Просмотреть файл

@ -1,9 +1,11 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
namespace BenchmarkDotNet.Helpers
{
[SuppressMessage("ReSharper", "InconsistentNaming")]
internal class PowerManagementHelper
{
private const uint ErrorMoreData = 234;

Просмотреть файл

@ -57,7 +57,7 @@ namespace BenchmarkDotNet.Helpers
RedirectStandardError = true
};
if(environmentVariables != null)
if (environmentVariables != null)
foreach (var environmentVariable in environmentVariables)
processStartInfo.Environment[environmentVariable.Key] = environmentVariable.Value;

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Numerics;
using BenchmarkDotNet.Extensions;
@ -95,6 +96,7 @@ namespace BenchmarkDotNet.Helpers
return false;
}
[SuppressMessage("ReSharper", "CompareOfFloatsByEqualityOperator")]
private static string ToSourceCode(double value)
{
if (double.IsNaN(value))
@ -113,6 +115,7 @@ namespace BenchmarkDotNet.Helpers
return value.ToString("G", CultureInfo.InvariantCulture) + "d";
}
[SuppressMessage("ReSharper", "CompareOfFloatsByEqualityOperator")]
private static string ToSourceCode(float value)
{
if (float.IsNaN(value))

Просмотреть файл

@ -1,6 +1,5 @@
using System.Diagnostics.CodeAnalysis;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Horology;
using Perfolizer.Mathematics.OutlierDetection;

Просмотреть файл

@ -19,7 +19,7 @@ namespace BenchmarkDotNet.Jobs
{
public MonoArgument(string value)
{
if(value == "--llvm" || value == "--nollvm")
if (value == "--llvm" || value == "--nollvm")
throw new NotSupportedException("Please use job.Env.Jit to specify Jit in explicit way");
TextRepresentation = value;

Просмотреть файл

@ -1,9 +1,11 @@
using BenchmarkDotNet.Characteristics;
using JetBrains.Annotations;
using System;
using System.Diagnostics.CodeAnalysis;
namespace BenchmarkDotNet.Jobs
{
[SuppressMessage("ReSharper", "UnassignedReadonlyField")]
public sealed class Job : JobMode<Job>
{
[PublicAPI] public static readonly Characteristic<EnvironmentMode> EnvironmentCharacteristic = CreateCharacteristic<EnvironmentMode>(nameof(Environment));

Просмотреть файл

@ -5,7 +5,6 @@ using System.Linq;
using BenchmarkDotNet.Analysers;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Toolchains;
using JetBrains.Annotations;
@ -121,7 +120,7 @@ namespace BenchmarkDotNet.Jobs
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using .WithStrategy instead")]
public static Job With(this Job job, RunStrategy strategy) => job.WithCore(j => j.Run.RunStrategy = strategy); // Run
/// <summary>
/// Available values: Throughput, ColdStart and Monitoring.
/// Throughput: default strategy which allows to get good precision level.
@ -227,7 +226,7 @@ namespace BenchmarkDotNet.Jobs
[Obsolete("This method will soon be removed, please start using .WithClock instead")]
public static Job With(this Job job, IClock clock) => job.WithClock(clock);
[PublicAPI] public static Job WithClock(this Job job, IClock clock) => job.WithCore(j => j.Infrastructure.Clock = clock);
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using .WithEngineFactory instead")]
public static Job With(this Job job, IEngineFactory engineFactory) => job.WithEngineFactory(engineFactory);
@ -249,7 +248,7 @@ namespace BenchmarkDotNet.Jobs
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will soon be removed, please start using .WithEnvironmentVariables instead")]
public static Job With(this Job job, IReadOnlyList<EnvironmentVariable> environmentVariables) => job.WithEnvironmentVariables(environmentVariables.ToArray());
/// <summary>
/// Creates a new job based on the given job with specified environment variables.
/// It overrides the whole list of environment variables which were defined in the original job.
@ -382,14 +381,14 @@ namespace BenchmarkDotNet.Jobs
/// Specifies which outliers should be removed from the distribution
/// </summary>
public static Job WithOutlierMode(this Job job, OutlierMode value) => job.WithCore(j => j.Accuracy.OutlierMode = value);
[PublicAPI]
public static Job WithAnalyzeLaunchVariance(this Job job, bool value) => job.WithCore(j => j.Accuracy.AnalyzeLaunchVariance = value);
// Meta
public static Job AsBaseline(this Job job) => job.WithCore(j => j.Meta.Baseline = true);
public static Job WithBaseline(this Job job, bool value) => job.WithCore(j => j.Meta.Baseline = value);
/// <summary>
/// mutator job should not be added to the config, but instead applied to other jobs in given config
/// </summary>

Просмотреть файл

@ -12,10 +12,10 @@ namespace BenchmarkDotNet.Loggers
// All AccumulationLoggers should have unique Ids
Id = nameof(AccumulationLogger) + "." + Guid.NewGuid().ToString("N");
}
public string Id { get; }
public int Priority => 0;
public virtual void Write(LogKind logKind, string text) => builder.Append(text);
public virtual void WriteLine() => builder.AppendLine();

Просмотреть файл

@ -27,7 +27,7 @@ namespace BenchmarkDotNet.Loggers
public string Id => nameof(ConsoleLogger);
public int Priority => unicodeSupport ? 1 : 0;
public void Write(LogKind logKind, string text) => Write(logKind, Console.Write, text);
public void WriteLine() => Console.WriteLine();
@ -40,7 +40,7 @@ namespace BenchmarkDotNet.Loggers
{
if (!unicodeSupport)
text = text.ToAscii();
var colorBefore = Console.ForegroundColor;
try

Просмотреть файл

@ -3,13 +3,13 @@
public interface ILogger
{
string Id { get; }
/// <summary>
/// If there are several loggers with the same <see cref="Id"/>,
/// only logger with the highest priority will be used.
/// </summary>
int Priority { get; }
void Write(LogKind logKind, string text);
void WriteLine();

Просмотреть файл

@ -51,14 +51,14 @@ namespace BenchmarkDotNet.Reports
public SummaryStyle WithCultureInfo(CultureInfo cultureInfo)
=> new SummaryStyle(cultureInfo, PrintUnitsInHeader, SizeUnit, TimeUnit, PrintUnitsInContent, PrintZeroValuesInContent, MaxParameterColumnWidth);
public bool Equals(SummaryStyle other)
{
if (ReferenceEquals(null, other))
return false;
if (ReferenceEquals(this, other))
return true;
return Equals(CultureInfo, other.CultureInfo)
return Equals(CultureInfo, other.CultureInfo)
&& PrintUnitsInHeader == other.PrintUnitsInHeader
&& PrintUnitsInContent == other.PrintUnitsInContent
&& PrintZeroValuesInContent == other.PrintZeroValuesInContent

Просмотреть файл

@ -215,7 +215,7 @@ namespace BenchmarkDotNet.Running
argumentsAttribute
.Values
.Select((value, index) =>
{
{
var definition = parameterDefinitions[index];
var type = definition.ParameterType;
return new ParameterInstance(definition, Map(value, type), summaryStyle);
@ -306,7 +306,7 @@ namespace BenchmarkDotNet.Running
else if (providedValue.GetType().IsEnum || type.IsEnum)
{
return EnumParam.FromObject(providedValue, type);
}
}
return providedValue;
}

Просмотреть файл

@ -47,11 +47,11 @@ namespace BenchmarkDotNet.Running
var supportedBenchmarks = GetSupportedBenchmarks(benchmarkRunInfos, compositeLogger, resolver);
if (!supportedBenchmarks.Any(benchmarks => benchmarks.BenchmarksCases.Any()))
return new [] { Summary.NothingToRun(title, resultsFolderPath, logFilePath) };
return new[] { Summary.NothingToRun(title, resultsFolderPath, logFilePath) };
var validationErrors = Validate(supportedBenchmarks, compositeLogger);
if (validationErrors.Any(validationError => validationError.IsCritical))
return new [] { Summary.ValidationFailed(title, resultsFolderPath, logFilePath, validationErrors) };
return new[] { Summary.ValidationFailed(title, resultsFolderPath, logFilePath, validationErrors) };
var benchmarksToRunCount = supportedBenchmarks.Sum(benchmarkInfo => benchmarkInfo.BenchmarksCases.Length);
compositeLogger.WriteLineHeader("// ***** BenchmarkRunner: Start *****");
@ -196,7 +196,7 @@ namespace BenchmarkDotNet.Running
private static void PrintSummary(ILogger logger, ImmutableConfig config, Summary summary)
{
var cultureInfo = config.CultureInfo ?? DefaultCultureInfo.Instance;
logger.WriteLineHeader("// ***** BenchmarkRunner: Finish *****");
logger.WriteLine();
@ -284,7 +284,7 @@ namespace BenchmarkDotNet.Running
logger.WriteLineHeader("// ***** Failed to build in Parallel, switching to sequential build *****");
foreach (var buildPartition in buildPartitions)
if (buildResults[buildPartition].IsGenerateSuccess && !buildResults[buildPartition].IsBuildSuccess && !buildResults[buildPartition].TryToExplainFailureReason(out var reason))
if (buildResults[buildPartition].IsGenerateSuccess && !buildResults[buildPartition].IsBuildSuccess && !buildResults[buildPartition].TryToExplainFailureReason(out string _))
buildResults[buildPartition] = Build(buildPartition, rootArtifactsFolderPath, buildLogger);
logger.WriteLineHeader($"// ***** Done, took {globalChronometer.GetElapsed().GetTimeSpan().ToFormattedTotalTime(DefaultCultureInfo.Instance)} *****");

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
@ -30,11 +31,15 @@ namespace BenchmarkDotNet.Running
[PublicAPI] public BenchmarkSwitcher With(Type type) { types.Add(type); return this; }
[PublicAPI] public BenchmarkSwitcher With(Type[] types) { this.types.AddRange(types); return this; }
[PublicAPI]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public BenchmarkSwitcher With(Type[] types) { this.types.AddRange(types); return this; }
[PublicAPI] public BenchmarkSwitcher With(Assembly assembly) { assemblies.Add(assembly); return this; }
[PublicAPI] public BenchmarkSwitcher With(Assembly[] assemblies) { this.assemblies.AddRange(assemblies); return this; }
[PublicAPI]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public BenchmarkSwitcher With(Assembly[] assemblies) { this.assemblies.AddRange(assemblies); return this; }
[PublicAPI] public static BenchmarkSwitcher FromTypes(Type[] types) => new BenchmarkSwitcher(types);
@ -67,7 +72,7 @@ namespace BenchmarkDotNet.Running
{
var notNullArgs = args ?? Array.Empty<string>();
var notNullConfig = config ?? DefaultConfig.Instance;
var logger = notNullConfig.GetNonNullCompositeLogger();
var (isParsingSuccess, parsedConfig, options) = ConfigParser.Parse(notNullArgs, logger, notNullConfig);
if (!isParsingSuccess) // invalid console args, the ConfigParser printed the error

Просмотреть файл

@ -11,7 +11,7 @@ namespace BenchmarkDotNet.Running
{
private static readonly Guid UserPowerPlan = new Guid("67b4a053-3646-4532-affd-0535c9ea82a7");
private static readonly Dictionary<PowerPlan, Guid> powerPlansDict = new Dictionary<PowerPlan, Guid>()
private static readonly Dictionary<PowerPlan, Guid> PowerPlansDict = new Dictionary<PowerPlan, Guid>()
{
{ PowerPlan.UserPowerPlan, UserPowerPlan },
{ PowerPlan.HighPerformance, new Guid("8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c") },
@ -22,14 +22,14 @@ namespace BenchmarkDotNet.Running
private readonly ILogger logger;
private Guid? userCurrentPowerPlan;
private bool powerPlanChanged = false;
private bool isInitialized = false;
private bool powerPlanChanged;
private bool isInitialized;
internal PowerManagementApplier(ILogger logger) => this.logger = logger;
public void Dispose() => ApplyUserPowerPlan();
internal static Guid Map(PowerPlan value) => powerPlansDict[value];
internal static Guid Map(PowerPlan value) => PowerPlansDict[value];
internal void ApplyPerformancePlan(Guid id)
{

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using BenchmarkDotNet.Toolchains.DotNetCli;
using JetBrains.Annotations;
@ -14,7 +15,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRt
private bool useCppCodeGenerator;
private string packagesRestorePath;
// we set those default values on purpose https://github.com/dotnet/BenchmarkDotNet/pull/1057#issuecomment-461832612
private bool rootAllApplicationAssemblies = false;
private bool rootAllApplicationAssemblies;
private bool ilcGenerateCompleteTypeMetadata = true;
private bool ilcGenerateStackTraceData = true;
@ -75,6 +76,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRt
/// The directory to restore packages to (optional).
/// </summary>
[PublicAPI]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public CoreRtToolchainBuilder PackagesRestorePath(string packagesRestorePath)
{
this.packagesRestorePath = packagesRestorePath;

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text;
@ -41,6 +42,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRt
private readonly string coreRtVersion;
private readonly bool useCppCodeGenerator;
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
private readonly string targetFrameworkMoniker;
private readonly string runtimeIdentifier;
private readonly IReadOnlyDictionary<string, string> feeds;
@ -201,7 +203,11 @@ $@"<?xml version=""1.0"" encoding=""utf-8""?>
</Directives>
";
File.WriteAllText(Path.Combine(Path.GetDirectoryName(artifactsPaths.ProjectFilePath), "rd.xml"), content);
string directoryName = Path.GetDirectoryName(artifactsPaths.ProjectFilePath);
if (directoryName != null)
File.WriteAllText(Path.Combine(directoryName, "rd.xml"), content);
else
throw new InvalidOperationException($"Can't get directory of projectFilePath ('{artifactsPaths.ProjectFilePath}')");
}
}
}

Просмотреть файл

@ -19,8 +19,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRun
private bool NeedsCopy => SourceCoreRun != CopyCoreRun;
protected override string GetPackagesDirectoryPath(string buildArtifactsDirectoryPath)
=> base.PackagesPath;
protected override string GetPackagesDirectoryPath(string buildArtifactsDirectoryPath) => PackagesPath;
protected override string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration)
=> Path.Combine(buildArtifactsDirectoryPath, "bin", configuration, TargetFrameworkMoniker, "publish");
@ -35,7 +34,7 @@ namespace BenchmarkDotNet.Toolchains.CoreRun
protected override string[] GetArtifactsToCleanup(ArtifactsPaths artifactsPaths)
=> NeedsCopy
? base.GetArtifactsToCleanup(artifactsPaths).Concat(new [] { CopyCoreRun.Directory.FullName }).ToArray()
? base.GetArtifactsToCleanup(artifactsPaths).Concat(new[] { CopyCoreRun.Directory.FullName }).ToArray()
: base.GetArtifactsToCleanup(artifactsPaths);
// source: https://stackoverflow.com/a/58779/5852046

Просмотреть файл

@ -51,10 +51,10 @@ namespace BenchmarkDotNet.Toolchains.CoreRun
var publishedVersionInfo = FileVersionInfo.GetVersionInfo(publishedDependency.FullName);
var coreRunVersionInfo = FileVersionInfo.GetVersionInfo(coreRunDependency.FullName);
if(!Version.TryParse(publishedVersionInfo.FileVersion, out var publishedVersion) || !Version.TryParse(coreRunVersionInfo.FileVersion, out var coreRunVersion))
if (!Version.TryParse(publishedVersionInfo.FileVersion, out var publishedVersion) || !Version.TryParse(coreRunVersionInfo.FileVersion, out var coreRunVersion))
continue;
if(publishedVersion > coreRunVersion)
if (publishedVersion > coreRunVersion)
{
File.Copy(publishedDependency.FullName, coreRunDependency.FullName, overwrite: true); // we need to overwrite old things with their newer versions

Просмотреть файл

@ -92,7 +92,7 @@ namespace BenchmarkDotNet.Toolchains.CsProj
// the host project or one of the .props file that it imports might contain some custom settings that needs to be copied, sth like
// <NetCoreAppImplicitPackageVersion>2.0.0-beta-001607-00</NetCoreAppImplicitPackageVersion>
// <RuntimeFrameworkVersion>2.0.0-beta-001607-00</RuntimeFrameworkVersion>
// <RuntimeFrameworkVersion>2.0.0-beta-001607-00</RuntimeFrameworkVersion>
internal (string customProperties, string sdkName) GetSettingsThatNeedsToBeCopied(TextReader streamReader, FileInfo projectFile)
{
if (!string.IsNullOrEmpty(RuntimeFrameworkVersion)) // some power users knows what to configure, just do it and copy nothing more

Просмотреть файл

@ -50,6 +50,7 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
/// <param name="targetFrameworkMoniker">TFM, example: netcoreapp2.1</param>
[PublicAPI]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public CustomDotNetCliToolchainBuilder TargetFrameworkMoniker(string targetFrameworkMoniker)
{
this.targetFrameworkMoniker = targetFrameworkMoniker ?? throw new ArgumentNullException(nameof(targetFrameworkMoniker));
@ -124,6 +125,7 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
/// sets provided timeout for build
/// </summary>
[PublicAPI]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public CustomDotNetCliToolchainBuilder Timeout(TimeSpan timeout)
{
this.timeout = timeout;

Просмотреть файл

@ -101,7 +101,7 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
=> directoryInfo
.GetFileSystemInfos()
.Any(fileInfo => fileInfo.Extension == ".sln" || fileInfo.Name == "global.json");
private static bool IsRootProjectFolder(DirectoryInfo directoryInfo)
=> directoryInfo
.GetFileSystemInfos()

Просмотреть файл

@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
{
internal static class MsBuildErrorMapper
{
private static readonly (Regex regex, Func<Match, string> translation)[] rules = new (Regex rule, Func<Match, string> translation)[]
private static readonly (Regex regex, Func<Match, string> translation)[] Rules = new (Regex rule, Func<Match, string> translation)[]
{
(
new Regex("warning NU1702: ProjectReference '(.*)' was resolved using '(.*)' instead of the project target framework '(.*)'. This project may not be fully compatible with your project.",
@ -40,7 +40,7 @@ namespace BenchmarkDotNet.Toolchains.DotNetCli
}
foreach (var errorLine in buildResult.ErrorMessage.Split('\r', '\n').Where(line => !string.IsNullOrEmpty(line)))
foreach (var rule in rules)
foreach (var rule in Rules)
{
var match = rule.regex.Match(errorLine);
if (match.Success)

Просмотреть файл

@ -76,8 +76,7 @@ namespace BenchmarkDotNet.Toolchains.InProcess.Emit
return GetExecutionResult(
host.RunResults,
exitCode,
executeParameters.Logger);
exitCode);
}
private int ExecuteCore(IHost host, ExecuteParameters parameters)
@ -127,7 +126,7 @@ namespace BenchmarkDotNet.Toolchains.InProcess.Emit
return exitCode;
}
private ExecuteResult GetExecutionResult(RunResults runResults, int exitCode, ILogger logger)
private ExecuteResult GetExecutionResult(RunResults runResults, int exitCode)
{
if (exitCode != 0)
{

Просмотреть файл

@ -8,56 +8,53 @@ using System.IO;
namespace BenchmarkDotNet.Toolchains.InProcess.Emit
{
public class InProcessEmitGenerator : IGenerator
{
public GenerateResult GenerateProject(
BuildPartition buildPartition,
ILogger logger,
string rootArtifactsFolderPath)
{
var artifactsPaths = ArtifactsPaths.Empty;
try
{
artifactsPaths = GetArtifactsPaths(buildPartition, rootArtifactsFolderPath);
public class InProcessEmitGenerator : IGenerator
{
public GenerateResult GenerateProject(
BuildPartition buildPartition,
ILogger logger,
string rootArtifactsFolderPath)
{
var artifactsPaths = ArtifactsPaths.Empty;
try
{
artifactsPaths = GetArtifactsPaths(buildPartition, rootArtifactsFolderPath);
return GenerateResult.Success(artifactsPaths, new List<string>());
}
catch (Exception ex)
{
logger.WriteLineError($"Failed to generate partition: {ex}");
return GenerateResult.Failure(artifactsPaths, new List<string>());
}
}
return GenerateResult.Success(artifactsPaths, new List<string>());
}
catch (Exception ex)
{
logger.WriteLineError($"Failed to generate partition: {ex}");
return GenerateResult.Failure(artifactsPaths, new List<string>());
}
}
private string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration) =>
buildArtifactsDirectoryPath;
private string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath) => buildArtifactsDirectoryPath;
private string GetExecutableExtension() => ".dll";
private string GetExecutableExtension() => ".dll";
private string GetBuildArtifactsDirectoryPath(
BuildPartition buildPartition, string programName) =>
Path.GetDirectoryName(buildPartition.AssemblyLocation);
private string GetBuildArtifactsDirectoryPath(BuildPartition buildPartition) => Path.GetDirectoryName(buildPartition.AssemblyLocation);
private ArtifactsPaths GetArtifactsPaths(BuildPartition buildPartition, string rootArtifactsFolderPath)
{
string programName = buildPartition.ProgramName + RunnableConstants.DynamicAssemblySuffix;
string buildArtifactsDirectoryPath = GetBuildArtifactsDirectoryPath(buildPartition, programName);
string binariesDirectoryPath =
GetBinariesDirectoryPath(buildArtifactsDirectoryPath, buildPartition.BuildConfiguration);
string executablePath = Path.Combine(binariesDirectoryPath, $"{programName}{GetExecutableExtension()}");
private ArtifactsPaths GetArtifactsPaths(BuildPartition buildPartition, string rootArtifactsFolderPath)
{
string programName = buildPartition.ProgramName + RunnableConstants.DynamicAssemblySuffix;
string buildArtifactsDirectoryPath = GetBuildArtifactsDirectoryPath(buildPartition);
string binariesDirectoryPath =
GetBinariesDirectoryPath(buildArtifactsDirectoryPath);
string executablePath = Path.Combine(binariesDirectoryPath, $"{programName}{GetExecutableExtension()}");
return new ArtifactsPaths(
rootArtifactsFolderPath: rootArtifactsFolderPath,
buildArtifactsDirectoryPath: buildArtifactsDirectoryPath,
binariesDirectoryPath: binariesDirectoryPath,
programCodePath: null,
appConfigPath: null,
nuGetConfigPath: null,
projectFilePath: null,
buildScriptFilePath: null,
executablePath: executablePath,
programName: programName,
packagesDirectoryName: null);
}
}
return new ArtifactsPaths(
rootArtifactsFolderPath: rootArtifactsFolderPath,
buildArtifactsDirectoryPath: buildArtifactsDirectoryPath,
binariesDirectoryPath: binariesDirectoryPath,
programCodePath: null,
appConfigPath: null,
nuGetConfigPath: null,
projectFilePath: null,
buildScriptFilePath: null,
executablePath: executablePath,
programName: programName,
packagesDirectoryName: null);
}
}
}

Просмотреть файл

@ -78,7 +78,7 @@ namespace BenchmarkDotNet.Toolchains.InProcess
$"Benchmark {executeParameters.BenchmarkCase.DisplayInfo} takes too long to run. " +
"Prefer to use out-of-process toolchains for long-running benchmarks.");
return GetExecutionResult(host.RunResults, exitCode, executeParameters.Logger);
return GetExecutionResult(host.RunResults, exitCode);
}
private int ExecuteCore(IHost host, ExecuteParameters parameters)
@ -121,7 +121,7 @@ namespace BenchmarkDotNet.Toolchains.InProcess
return exitCode;
}
private ExecuteResult GetExecutionResult(RunResults runResults, int exitCode, ILogger logger)
private ExecuteResult GetExecutionResult(RunResults runResults, int exitCode)
{
if (exitCode != 0)
{

Просмотреть файл

@ -39,7 +39,7 @@ namespace BenchmarkDotNet.Toolchains
return RoslynToolchain.Instance;
case MonoRuntime mono:
if(!string.IsNullOrEmpty(mono.AotArgs))
if (!string.IsNullOrEmpty(mono.AotArgs))
return MonoAotToolchain.Instance;
return RoslynToolchain.Instance;

Просмотреть файл

@ -83,7 +83,7 @@ namespace BenchmarkDotNet.Validators
return from memberInfo in memberInfos
where memberInfo.Name.EndsWith("Keyword")
orderby memberInfo.Name
select memberInfo.Name.Substring(startIndex: 0, length: memberInfo.Name.IndexOf("Keyword")).ToLower();
select memberInfo.Name.Substring(startIndex: 0, length: memberInfo.Name.IndexOf("Keyword", StringComparison.Ordinal)).ToLower();
}
private class BenchmarkMethodEqualityComparer : IEqualityComparer<BenchmarkCase>

Просмотреть файл

@ -7,7 +7,7 @@ using BenchmarkDotNet.Extensions;
namespace BenchmarkDotNet.Validators
{
class ParamsAllValuesValidator : IValidator
public class ParamsAllValuesValidator : IValidator
{
public static readonly ParamsAllValuesValidator FailOnError = new ParamsAllValuesValidator();
@ -15,13 +15,13 @@ namespace BenchmarkDotNet.Validators
private ParamsAllValuesValidator() { }
private const BindingFlags reflectionFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
private const BindingFlags ReflectionFlags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
public IEnumerable<ValidationError> Validate(ValidationParameters input) =>
input.Benchmarks
.Select(benchmark => benchmark.Descriptor.Type)
.Distinct()
.SelectMany(type => type.GetTypeMembersWithGivenAttribute<ParamsAllValuesAttribute>(reflectionFlags))
.SelectMany(type => type.GetTypeMembersWithGivenAttribute<ParamsAllValuesAttribute>(ReflectionFlags))
.Distinct()
.Select(member => GetErrorOrDefault(member.ParameterType))
.Where(error => error != null);

Просмотреть файл

@ -9,7 +9,7 @@ namespace BenchmarkDotNet.IntegrationTests.CustomPaths
[Benchmark]
public void Verify()
{
if(!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "ShouldGetCopied.xml")))
if (!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "ShouldGetCopied.xml")))
{
throw new InvalidOperationException("the file did not get copied");
}

Просмотреть файл

@ -54,7 +54,7 @@ namespace BenchmarkDotNet.IntegrationTests.ManualRunning
}
}
[KeepBenchmarkFiles()]
[KeepBenchmarkFiles]
public class CoreRtBenchmark
{
[Benchmark]

Просмотреть файл

@ -17,8 +17,8 @@ namespace BenchmarkDotNet.IntegrationTests
public class ConsumingCustomAttributes
{
const int ExpectedNumber = 123;
const string ExpectedText = "expectedTest";
private const int ExpectedNumber = 123;
private const string ExpectedText = "expectedTest";
[CustomParams(ExpectedNumber)]
public int Number;
@ -34,18 +34,18 @@ namespace BenchmarkDotNet.IntegrationTests
[CustomBenchmark]
public void Benchmark()
{
if(ExpectedNumber != Number || ExpectedText != Text)
if (ExpectedNumber != Number || ExpectedText != Text)
throw new Exception("Custom attributes were not applied!");
}
}
class CustomParamsAttribute : ParamsAttribute
private class CustomParamsAttribute : ParamsAttribute
{
public CustomParamsAttribute(params object[] values) : base(values) { }
}
class CustomBenchmarkAttribute : BenchmarkAttribute { }
private class CustomBenchmarkAttribute : BenchmarkAttribute { }
class CustomGlobalSetupAttribute : GlobalSetupAttribute { }
private class CustomGlobalSetupAttribute : GlobalSetupAttribute { }
}
}

Просмотреть файл

@ -11,6 +11,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<NoWarn>$(NoWarn);CA2007</NoWarn>
</PropertyGroup>
<ItemGroup>
<Content Include="xunit.runner.json">

Просмотреть файл

@ -60,7 +60,7 @@ namespace BenchmarkDotNet.IntegrationTests
var config = ManualConfig.CreateEmpty().AddLogger(logger);
var summaries = BenchmarkSwitcher
.FromTypes(new [] { typeof(ClassC) })
.FromTypes(new[] { typeof(ClassC) })
.Run(new[] { "--filter", "*" }, config);
Assert.Empty(summaries);
@ -89,7 +89,7 @@ namespace BenchmarkDotNet.IntegrationTests
const string filter = "WRONG";
var summaries = BenchmarkSwitcher
.FromTypes(new [] { typeof(ClassA), typeof(ClassB) })
.FromTypes(new[] { typeof(ClassA), typeof(ClassB) })
.Run(new[] { "--filter", filter }, config);
Assert.Empty(summaries);
@ -103,7 +103,7 @@ namespace BenchmarkDotNet.IntegrationTests
var config = ManualConfig.CreateEmpty().AddLogger(logger);
var summaries = BenchmarkSwitcher
.FromTypes(new [] { typeof(ClassA) })
.FromTypes(new[] { typeof(ClassA) })
.Run(new[] { "--list", "flat" }, config);
Assert.Empty(summaries);
@ -118,7 +118,7 @@ namespace BenchmarkDotNet.IntegrationTests
var config = ManualConfig.CreateEmpty().AddLogger(logger);
var summaries = BenchmarkSwitcher
.FromTypes(new [] { typeof(ClassA) })
.FromTypes(new[] { typeof(ClassA) })
.Run(new[] { "--list", "flat", "--filter", "*.Method1" }, config);
Assert.Empty(summaries);
@ -187,7 +187,7 @@ namespace BenchmarkDotNet.IntegrationTests
var userInteractionMock = new UserInteractionMock(returnValue: Array.Empty<Type>());
var summaries = new BenchmarkSwitcher(userInteractionMock)
.With(new [] { typeof(WithDryAttributeAndCategory) })
.With(new[] { typeof(WithDryAttributeAndCategory) })
.Run(Array.Empty<string>(), config);
Assert.Empty(summaries); // summaries is empty because the returnValue configured for mock returns 0 types
@ -206,7 +206,7 @@ namespace BenchmarkDotNet.IntegrationTests
var summaries = new BenchmarkSwitcher(userInteractionMock)
.With(types)
.Run(new [] { categoriesConsoleLineArgument, TestCategory }, config);
.Run(new[] { categoriesConsoleLineArgument, TestCategory }, config);
Assert.Single(summaries);
Assert.Equal(0, userInteractionMock.AskUserCalledTimes);
@ -224,7 +224,7 @@ namespace BenchmarkDotNet.IntegrationTests
var summaries = new BenchmarkSwitcher(userInteractionMock)
.With(types)
.Run(new [] { categoriesConsoleLineArgument, TestCategory, "--filter", "nothing" }, config);
.Run(new[] { categoriesConsoleLineArgument, TestCategory, "--filter", "nothing" }, config);
Assert.Empty(summaries); // the summaries is empty because the provided filter returns nothing
Assert.Equal(0, userInteractionMock.AskUserCalledTimes);

Просмотреть файл

@ -9,7 +9,6 @@ using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Mathematics;
using Perfolizer.Mathematics.OutlierDetection;
namespace BenchmarkDotNet.IntegrationTests

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше