Code cleanup
This commit is contained in:
Родитель
c3286f8306
Коммит
3223c94a92
|
@ -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" />
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace BenchmarkDotNet.Samples
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BenchmarkDotNet.Disassemblers
|
|||
// 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);
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using BenchmarkDotNet.Jobs;
|
||||
using BenchmarkDotNet.Mathematics;
|
||||
using Perfolizer.Mathematics.OutlierDetection;
|
||||
|
||||
namespace BenchmarkDotNet.Attributes
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using BenchmarkDotNet.Characteristics;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
using BenchmarkDotNet.Mathematics;
|
||||
using Perfolizer.Horology;
|
||||
using Perfolizer.Mathematics.OutlierDetection;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -29,21 +29,18 @@ namespace BenchmarkDotNet.Toolchains.InProcess.Emit
|
|||
}
|
||||
}
|
||||
|
||||
private string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath, string configuration) =>
|
||||
buildArtifactsDirectoryPath;
|
||||
private string GetBinariesDirectoryPath(string buildArtifactsDirectoryPath) => buildArtifactsDirectoryPath;
|
||||
|
||||
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 buildArtifactsDirectoryPath = GetBuildArtifactsDirectoryPath(buildPartition);
|
||||
string binariesDirectoryPath =
|
||||
GetBinariesDirectoryPath(buildArtifactsDirectoryPath, buildPartition.BuildConfiguration);
|
||||
GetBinariesDirectoryPath(buildArtifactsDirectoryPath);
|
||||
string executablePath = Path.Combine(binariesDirectoryPath, $"{programName}{GetExecutableExtension()}");
|
||||
|
||||
return new ArtifactsPaths(
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -39,13 +39,13 @@ namespace BenchmarkDotNet.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
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">
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,7 +5,6 @@ using System.Linq;
|
|||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Exporters;
|
||||
using BenchmarkDotNet.Helpers;
|
||||
using BenchmarkDotNet.Loggers;
|
||||
using BenchmarkDotNet.Reports;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
|
|
@ -131,8 +131,8 @@ namespace BenchmarkDotNet.IntegrationTests
|
|||
|
||||
public class AvoidForcingGarbageCollection
|
||||
{
|
||||
int initialCollectionCountGen1;
|
||||
int initialCollectionCountGen2;
|
||||
private int initialCollectionCountGen1;
|
||||
private int initialCollectionCountGen2;
|
||||
|
||||
[GlobalSetup]
|
||||
public void GlobalSetup()
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Engines;
|
||||
using BenchmarkDotNet.Engines;
|
||||
using BenchmarkDotNet.Running;
|
||||
using BenchmarkDotNet.Toolchains.InProcess.Emit.Implementation;
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@ using JetBrains.Annotations;
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace BenchmarkDotNet.IntegrationTests
|
||||
{
|
||||
public class InProcessTest : BenchmarkTestExecutor
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace BenchmarkDotNet.IntegrationTests
|
|||
}
|
||||
|
||||
private const string OkCaption = "// OkCaption";
|
||||
private const string LegacyJitNotAvailableForMono = "// ERROR: LegacyJIT is requested but it is not available for Mono";
|
||||
// private const string LegacyJitNotAvailableForMono = "// ERROR: LegacyJIT is requested but it is not available for Mono";
|
||||
private const string RyuJitNotAvailable = "// ERROR: RyuJIT is requested but it is not available in current environment";
|
||||
private const string ToolchainSupportsOnlyRyuJit = "Currently dotnet cli toolchain supports only RyuJit";
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace BenchmarkDotNet.IntegrationTests
|
|||
AssertAllocations(toolchain, typeof(AccurateAllocations), new Dictionary<string, long>
|
||||
{
|
||||
{ nameof(AccurateAllocations.EightBytesArray), 8 + objectAllocationOverhead + arraySizeOverhead },
|
||||
{ nameof(AccurateAllocations.SixtyFourBytesArray), 64 + + objectAllocationOverhead + arraySizeOverhead },
|
||||
{ nameof(AccurateAllocations.SixtyFourBytesArray), 64 + objectAllocationOverhead + arraySizeOverhead },
|
||||
|
||||
{ nameof(AccurateAllocations.AllocateTask), CalculateRequiredSpace<Task<int>>() },
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Environments;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
|
@ -12,11 +11,11 @@ namespace BenchmarkDotNet.IntegrationTests
|
|||
{
|
||||
public class ProcessorArchitectureTest : BenchmarkTestExecutor
|
||||
{
|
||||
const string X86FailedCaption = "// x86FAILED";
|
||||
const string X64FailedCaption = "// x64FAILED";
|
||||
const string AnyCpuOkCaption = "// AnyCpuOkCaption";
|
||||
const string HostPlatformOkCaption = "// HostPlatformOkCaption";
|
||||
const string BenchmarkNotFound = "// There are no benchmarks found";
|
||||
private const string X86FailedCaption = "// x86FAILED";
|
||||
private const string X64FailedCaption = "// x64FAILED";
|
||||
private const string AnyCpuOkCaption = "// AnyCpuOkCaption";
|
||||
private const string HostPlatformOkCaption = "// HostPlatformOkCaption";
|
||||
private const string BenchmarkNotFound = "// There are no benchmarks found";
|
||||
|
||||
public ProcessorArchitectureTest(ITestOutputHelper outputHelper) : base(outputHelper)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
using ApprovalTests;
|
||||
using ApprovalTests.Namers;
|
||||
using ApprovalTests.Reporters;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Exporters;
|
||||
using BenchmarkDotNet.Loggers;
|
||||
using BenchmarkDotNet.Tests.Mocks;
|
||||
|
@ -15,8 +14,6 @@ using BenchmarkDotNet.Attributes;
|
|||
using BenchmarkDotNet.Validators;
|
||||
using JetBrains.Annotations;
|
||||
using Xunit;
|
||||
using System.Collections.Generic;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
||||
namespace BenchmarkDotNet.Tests.Attributes
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<PackageId>BenchmarkDotNet.Tests</PackageId>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);NU1701;1701;CA1018;CA2007</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="xunit.runner.json">
|
||||
|
@ -20,9 +21,6 @@
|
|||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="ApprovalTests" Version="3.0.13" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<NoWarn>NU1701;1701</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
|
||||
<ProjectReference Include="..\..\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj" />
|
||||
<PackageReference Include="Microsoft.NETCore.Platforms" Version="2.2.0" />
|
||||
|
|
|
@ -22,7 +22,6 @@ using BenchmarkDotNet.Toolchains.DotNetCli;
|
|||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using BenchmarkDotNet.Portability;
|
||||
using BenchmarkDotNet.Extensions;
|
||||
using Perfolizer.Horology;
|
||||
using Perfolizer.Mathematics.SignificanceTesting;
|
||||
using Perfolizer.Mathematics.Thresholds;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using BenchmarkDotNet.Toolchains.CsProj;
|
||||
using JetBrains.Annotations;
|
||||
using Xunit;
|
||||
|
|
|
@ -13,31 +13,31 @@ namespace BenchmarkDotNet.Tests.Engine
|
|||
{
|
||||
public class EngineFactoryTests
|
||||
{
|
||||
int timesBenchmarkCalled = 0, timesOverheadCalled = 0;
|
||||
int timesGlobalSetupCalled = 0, timesGlobalCleanupCalled = 0, timesIterationSetupCalled = 0, timesIterationCleanupCalled = 0;
|
||||
private int timesBenchmarkCalled = 0, timesOverheadCalled = 0;
|
||||
private int timesGlobalSetupCalled = 0, timesGlobalCleanupCalled = 0, timesIterationSetupCalled = 0, timesIterationCleanupCalled = 0;
|
||||
|
||||
TimeSpan IterationTime => TimeSpan.FromMilliseconds(EngineResolver.Instance.Resolve(Job.Default, RunMode.IterationTimeCharacteristic).ToMilliseconds());
|
||||
private TimeSpan IterationTime => TimeSpan.FromMilliseconds(EngineResolver.Instance.Resolve(Job.Default, RunMode.IterationTimeCharacteristic).ToMilliseconds());
|
||||
|
||||
IResolver DefaultResolver => BenchmarkRunnerClean.DefaultResolver;
|
||||
private IResolver DefaultResolver => BenchmarkRunnerClean.DefaultResolver;
|
||||
|
||||
void GlobalSetup() => timesGlobalSetupCalled++;
|
||||
void IterationSetup() => timesIterationSetupCalled++;
|
||||
void IterationCleanup() => timesIterationCleanupCalled++;
|
||||
void GlobalCleanup() => timesGlobalCleanupCalled++;
|
||||
private void GlobalSetup() => timesGlobalSetupCalled++;
|
||||
private void IterationSetup() => timesIterationSetupCalled++;
|
||||
private void IterationCleanup() => timesIterationCleanupCalled++;
|
||||
private void GlobalCleanup() => timesGlobalCleanupCalled++;
|
||||
|
||||
void Throwing(long _) => throw new InvalidOperationException("must NOT be called");
|
||||
private void Throwing(long _) => throw new InvalidOperationException("must NOT be called");
|
||||
|
||||
void VeryTimeConsumingSingle(long _)
|
||||
private void VeryTimeConsumingSingle(long _)
|
||||
{
|
||||
timesBenchmarkCalled++;
|
||||
Thread.Sleep(IterationTime);
|
||||
}
|
||||
|
||||
void InstantNoUnroll(long invocationCount) => timesBenchmarkCalled += (int) invocationCount;
|
||||
void InstantUnroll(long _) => timesBenchmarkCalled += 16;
|
||||
private void InstantNoUnroll(long invocationCount) => timesBenchmarkCalled += (int) invocationCount;
|
||||
private void InstantUnroll(long _) => timesBenchmarkCalled += 16;
|
||||
|
||||
void OverheadNoUnroll(long invocationCount) => timesOverheadCalled += (int) invocationCount;
|
||||
void OverheadUnroll(long _) => timesOverheadCalled += 16;
|
||||
private void OverheadNoUnroll(long invocationCount) => timesOverheadCalled += (int) invocationCount;
|
||||
private void OverheadUnroll(long _) => timesOverheadCalled += 16;
|
||||
|
||||
private static readonly Dictionary<string, Job> JobsWhichDontRequireJitting = new Dictionary<string, Job>
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BenchmarkDotNet.Engines;
|
||||
using BenchmarkDotNet.Mathematics;
|
||||
using BenchmarkDotNet.Reports;
|
||||
using JetBrains.Annotations;
|
||||
using Perfolizer.Mathematics.OutlierDetection;
|
||||
|
|
|
@ -9,7 +9,6 @@ using ApprovalTests.Reporters;
|
|||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Exporters;
|
||||
using BenchmarkDotNet.Exporters.Csv;
|
||||
using BenchmarkDotNet.Exporters.Json;
|
||||
using BenchmarkDotNet.Exporters.Xml;
|
||||
using BenchmarkDotNet.Loggers;
|
||||
|
|
|
@ -3,9 +3,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Code;
|
||||
using BenchmarkDotNet.Exporters;
|
||||
using BenchmarkDotNet.Running;
|
||||
using Xunit;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using BenchmarkDotNet.Loggers;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace BenchmarkDotNet.Tests.Loggers
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using BenchmarkDotNet.Helpers;
|
||||
using BenchmarkDotNet.Mathematics;
|
||||
using Perfolizer.Mathematics.Common;
|
||||
using Xunit;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Parameters;
|
||||
using BenchmarkDotNet.Parameters;
|
||||
using BenchmarkDotNet.Reports;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BenchmarkDotNet.Extensions;
|
||||
using BenchmarkDotNet.Reports;
|
||||
using JetBrains.Annotations;
|
||||
using Xunit;
|
||||
|
|
|
@ -3,7 +3,6 @@ using BenchmarkDotNet.Attributes;
|
|||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Environments;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
using BenchmarkDotNet.Mathematics;
|
||||
using BenchmarkDotNet.Running;
|
||||
using Perfolizer.Mathematics.OutlierDetection;
|
||||
using Xunit;
|
||||
|
|
|
@ -128,4 +128,3 @@ namespace BenchmarkDotNet.Tests
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Xunit;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.ConsoleArguments;
|
||||
using BenchmarkDotNet.ConsoleArguments.ListBenchmarks;
|
||||
using BenchmarkDotNet.Extensions;
|
||||
using BenchmarkDotNet.Loggers;
|
||||
using BenchmarkDotNet.Tests;
|
||||
|
|
Загрузка…
Ссылка в новой задаче