diff --git a/BenchmarkDotNet.sln.DotSettings b/BenchmarkDotNet.sln.DotSettings
index 7f5e287ce3..b81d1cbadc 100644
--- a/BenchmarkDotNet.sln.DotSettings
+++ b/BenchmarkDotNet.sln.DotSettings
@@ -12,12 +12,10 @@
DO_NOT_SHOW
True
-
True
True
-
DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
@@ -25,6 +23,10 @@
DO_NOT_SHOW
DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
+ DO_NOT_SHOW
True
NotRequired
ExpressionBody
diff --git a/src/BenchmarkDotNet/Analysers/AnalyserBase.cs b/src/BenchmarkDotNet/Analysers/AnalyserBase.cs
index 1acf5cf1d1..81129dee04 100644
--- a/src/BenchmarkDotNet/Analysers/AnalyserBase.cs
+++ b/src/BenchmarkDotNet/Analysers/AnalyserBase.cs
@@ -18,11 +18,11 @@ public IEnumerable Analyse(Summary summary)
yield return conclusion;
}
- public virtual IEnumerable AnalyseSummary(Summary summary) => Enumerable.Empty();
- public virtual IEnumerable AnalyseReport(BenchmarkReport report, Summary summary) => Enumerable.Empty();
+ protected virtual IEnumerable AnalyseSummary(Summary summary) => Enumerable.Empty();
+ protected virtual IEnumerable AnalyseReport(BenchmarkReport report, Summary summary) => Enumerable.Empty();
- public Conclusion CreateHint(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateHint(Id, message, report);
- public Conclusion CreateWarning(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateWarning(Id, message, report);
- public Conclusion CreateError(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateError(Id, message, report);
+ protected Conclusion CreateHint(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateHint(Id, message, report);
+ protected Conclusion CreateWarning(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateWarning(Id, message, report);
+ protected Conclusion CreateError(string message, [CanBeNull] BenchmarkReport report = null) => Conclusion.CreateError(Id, message, report);
}
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Analysers/EnvironmentAnalyser.cs b/src/BenchmarkDotNet/Analysers/EnvironmentAnalyser.cs
index d754bcf7a9..7b007327fb 100644
--- a/src/BenchmarkDotNet/Analysers/EnvironmentAnalyser.cs
+++ b/src/BenchmarkDotNet/Analysers/EnvironmentAnalyser.cs
@@ -18,13 +18,13 @@ private EnvironmentAnalyser()
{
}
- public override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
+ protected override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
{
if (report.BenchmarkCase.Descriptor.Type.GetTypeInfo().Assembly.IsJitOptimizationDisabled().IsTrue())
yield return CreateWarning("Benchmark was built without optimization enabled (most probably a DEBUG configuration). Please, build it in RELEASE.", report);
}
- public override IEnumerable AnalyseSummary(Summary summary)
+ protected override IEnumerable AnalyseSummary(Summary summary)
{
if (summary.HostEnvironmentInfo.HasAttachedDebugger)
yield return CreateWarning("Benchmark was executed with attached debugger");
diff --git a/src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs b/src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs
index a696aaffea..c3b0b55e50 100644
--- a/src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs
+++ b/src/BenchmarkDotNet/Analysers/MinIterationTimeAnalyser.cs
@@ -18,7 +18,7 @@ private MinIterationTimeAnalyser()
{
}
- public override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
+ protected override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
{
var target = report.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Actual)).ToArray();
if (target.IsEmpty())
diff --git a/src/BenchmarkDotNet/Analysers/MultimodalDistributionAnalyzer.cs b/src/BenchmarkDotNet/Analysers/MultimodalDistributionAnalyzer.cs
index ee80d9e88c..08aeb824eb 100644
--- a/src/BenchmarkDotNet/Analysers/MultimodalDistributionAnalyzer.cs
+++ b/src/BenchmarkDotNet/Analysers/MultimodalDistributionAnalyzer.cs
@@ -15,7 +15,7 @@ private MultimodalDistributionAnalyzer() { }
public override string Id => "MultimodalDistribution";
- public override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
+ protected override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
{
var statistics = report.ResultStatistics;
if (statistics == null || statistics.N < EngineResolver.DefaultMinWorkloadIterationCount)
diff --git a/src/BenchmarkDotNet/Analysers/OutliersAnalyser.cs b/src/BenchmarkDotNet/Analysers/OutliersAnalyser.cs
index c7ff718bbe..9e17c3101d 100644
--- a/src/BenchmarkDotNet/Analysers/OutliersAnalyser.cs
+++ b/src/BenchmarkDotNet/Analysers/OutliersAnalyser.cs
@@ -15,7 +15,7 @@ public class OutliersAnalyser : AnalyserBase
private OutliersAnalyser() { }
- public override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
+ protected override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
{
var workloadActual = report.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Actual)).ToArray();
if (workloadActual.IsEmpty())
diff --git a/src/BenchmarkDotNet/Analysers/RuntimeErrorAnalyser.cs b/src/BenchmarkDotNet/Analysers/RuntimeErrorAnalyser.cs
index 11877dcff3..0955b22a4a 100644
--- a/src/BenchmarkDotNet/Analysers/RuntimeErrorAnalyser.cs
+++ b/src/BenchmarkDotNet/Analysers/RuntimeErrorAnalyser.cs
@@ -14,7 +14,7 @@ private RuntimeErrorAnalyser()
{
}
- public override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
+ protected override IEnumerable AnalyseReport(BenchmarkReport report, Summary summary)
{
var errors = report.ExecuteResults.SelectMany(r => r.Data)
.Union(report.ExecuteResults.SelectMany(r => r.ExtraOutput))
diff --git a/src/BenchmarkDotNet/Attributes/ArgumentsAttribute.cs b/src/BenchmarkDotNet/Attributes/ArgumentsAttribute.cs
index d2a421dadc..99836c4b93 100644
--- a/src/BenchmarkDotNet/Attributes/ArgumentsAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/ArgumentsAttribute.cs
@@ -5,7 +5,7 @@ namespace BenchmarkDotNet.Attributes
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class ArgumentsAttribute : Attribute
{
- public object[] Values { get; private set; }
+ public object[] Values { get; }
// CLS-Compliant Code requires a constructor without an array in the argument list
public ArgumentsAttribute()
diff --git a/src/BenchmarkDotNet/Attributes/ArtifactsPathAttribute.cs b/src/BenchmarkDotNet/Attributes/ArtifactsPathAttribute.cs
index d3f79ca606..5b28276de4 100644
--- a/src/BenchmarkDotNet/Attributes/ArtifactsPathAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/ArtifactsPathAttribute.cs
@@ -1,8 +1,10 @@
using System;
using BenchmarkDotNet.Configs;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Attributes
{
+ [PublicAPI]
public class ArtifactsPathAttribute : Attribute, IConfigSource
{
public string Value { get; }
diff --git a/src/BenchmarkDotNet/Attributes/Exporters/JsonExporterAttribute.cs b/src/BenchmarkDotNet/Attributes/Exporters/JsonExporterAttribute.cs
index f0fc8f9b7e..dee4da2dd5 100644
--- a/src/BenchmarkDotNet/Attributes/Exporters/JsonExporterAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/Exporters/JsonExporterAttribute.cs
@@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Attributes
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
public class JsonExporterAttribute : ExporterConfigBaseAttribute
{
- protected JsonExporterAttribute(IExporter exporter) : base(exporter)
+ private JsonExporterAttribute(IExporter exporter) : base(exporter)
{
}
diff --git a/src/BenchmarkDotNet/Attributes/Exporters/XmlExporterAttribute.cs b/src/BenchmarkDotNet/Attributes/Exporters/XmlExporterAttribute.cs
index 8c4a0ccc41..7c098bf434 100644
--- a/src/BenchmarkDotNet/Attributes/Exporters/XmlExporterAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/Exporters/XmlExporterAttribute.cs
@@ -7,7 +7,7 @@ namespace BenchmarkDotNet.Attributes
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
public class XmlExporterAttribute : ExporterConfigBaseAttribute
{
- public XmlExporterAttribute(IExporter exporter) : base(exporter)
+ private XmlExporterAttribute(IExporter exporter) : base(exporter)
{
}
diff --git a/src/BenchmarkDotNet/Attributes/Jobs/JobConfigbaseAttribute.cs b/src/BenchmarkDotNet/Attributes/Jobs/JobConfigbaseAttribute.cs
index 3840404d5e..fb394813fa 100644
--- a/src/BenchmarkDotNet/Attributes/Jobs/JobConfigbaseAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/Jobs/JobConfigbaseAttribute.cs
@@ -9,8 +9,8 @@ public class JobConfigBaseAttribute : Attribute, IConfigSource
{
// CLS-Compliant Code requires a constructor which use only CLS-compliant types
public JobConfigBaseAttribute() => Config = ManualConfig.CreateEmpty();
-
- public JobConfigBaseAttribute(Job job) => Config = ManualConfig.CreateEmpty().With(job);
+
+ protected JobConfigBaseAttribute(Job job) => Config = ManualConfig.CreateEmpty().With(job);
public IConfig Config { get; }
}
diff --git a/src/BenchmarkDotNet/Attributes/KeepBenchmarkFilesAttribute.cs b/src/BenchmarkDotNet/Attributes/KeepBenchmarkFilesAttribute.cs
index 8ef24024ab..4616ef62ed 100644
--- a/src/BenchmarkDotNet/Attributes/KeepBenchmarkFilesAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/KeepBenchmarkFilesAttribute.cs
@@ -5,12 +5,10 @@ namespace BenchmarkDotNet.Attributes
{
public class KeepBenchmarkFilesAttribute : Attribute, IConfigSource
{
- public bool Value { get; }
public IConfig Config { get; }
public KeepBenchmarkFilesAttribute(bool value = true)
{
- Value = value;
Config = ManualConfig.CreateEmpty().KeepBenchmarkFiles(value);
}
}
diff --git a/src/BenchmarkDotNet/Attributes/ParamsAttribute.cs b/src/BenchmarkDotNet/Attributes/ParamsAttribute.cs
index 29bdf2a1e5..f8974e1248 100644
--- a/src/BenchmarkDotNet/Attributes/ParamsAttribute.cs
+++ b/src/BenchmarkDotNet/Attributes/ParamsAttribute.cs
@@ -5,7 +5,7 @@ namespace BenchmarkDotNet.Attributes
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public class ParamsAttribute : Attribute
{
- public object[] Values { get; private set; }
+ public object[] Values { get; }
// CLS-Compliant Code requires a constructor without an array in the argument list
public ParamsAttribute()
diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic.cs b/src/BenchmarkDotNet/Characteristics/Characteristic.cs
index bc21a0421a..b83aad315a 100644
--- a/src/BenchmarkDotNet/Characteristics/Characteristic.cs
+++ b/src/BenchmarkDotNet/Characteristics/Characteristic.cs
@@ -82,7 +82,7 @@ protected Characteristic(
public Type DeclaringType { get; }
- public object FallbackValue { get; }
+ private object FallbackValue { get; }
public object this[CharacteristicObject obj]
{
diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs
index e6e947d13c..3dcce84b79 100644
--- a/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs
+++ b/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs
@@ -12,12 +12,11 @@ public static class CharacteristicHelper
internal static bool IsCharacteristicObjectSubclass(Type type) =>
type.GetTypeInfo().IsSubclassOf(typeof(CharacteristicObject));
- internal static bool IsCharacteristicSubclass(Type type) =>
+ private static bool IsCharacteristicSubclass(Type type) =>
type.GetTypeInfo().IsSubclassOf(typeof(Characteristic));
private static Characteristic AssertHasValue(MemberInfo member, Characteristic value)
{
- // ReSharper disable once PossibleNullReferenceException
if (value == null)
throw new ArgumentException(
$"The value of {member.DeclaringType.Name}.{member.Name} is null");
diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs
index f6299814c7..521e56ec08 100644
--- a/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs
+++ b/src/BenchmarkDotNet/Characteristics/CharacteristicObject.cs
@@ -49,7 +49,8 @@ protected CharacteristicObject(string id) : this()
#endregion
#region Assertions
- protected void AssertNotFrozen()
+
+ private void AssertNotFrozen()
{
if (Frozen)
{
@@ -57,7 +58,7 @@ protected void AssertNotFrozen()
}
}
- protected void AssertIsRoot()
+ private void AssertIsRoot()
{
if (Owner != null)
{
@@ -67,13 +68,13 @@ protected void AssertIsRoot()
}
}
- protected void AssertIsNonFrozenRoot()
+ private void AssertIsNonFrozenRoot()
{
AssertNotFrozen();
AssertIsRoot();
}
- protected void AssertIsAssignable(Characteristic characteristic, object value)
+ private static void AssertIsAssignable(Characteristic characteristic, object value)
{
if (ReferenceEquals(value, Characteristic.EmptyValue) || ReferenceEquals(value, null))
{
@@ -91,7 +92,8 @@ protected void AssertIsAssignable(Characteristic characteristic, object value)
#endregion
#region Properties
- protected CharacteristicObject Owner => owner;
+
+ private CharacteristicObject Owner => owner;
protected CharacteristicObject OwnerOrSelf => owner ?? this;
diff --git a/src/BenchmarkDotNet/Characteristics/CharacteristicObject`1.cs b/src/BenchmarkDotNet/Characteristics/CharacteristicObject`1.cs
index cda74afdb9..9723255b46 100644
--- a/src/BenchmarkDotNet/Characteristics/CharacteristicObject`1.cs
+++ b/src/BenchmarkDotNet/Characteristics/CharacteristicObject`1.cs
@@ -1,4 +1,6 @@
-namespace BenchmarkDotNet.Characteristics
+using JetBrains.Annotations;
+
+namespace BenchmarkDotNet.Characteristics
{
public abstract class CharacteristicObject : CharacteristicObject
where T : CharacteristicObject, new()
@@ -9,6 +11,7 @@ protected CharacteristicObject(string id) : base(id) { }
public new T Apply(CharacteristicObject other) => (T)ApplyCore(other);
+ [PublicAPI]
public T Apply(params CharacteristicObject[] others)
{
var result = this;
diff --git a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs
index 52fb34ac53..bd4fb78946 100644
--- a/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs
+++ b/src/BenchmarkDotNet/Characteristics/Characteristic`1.cs
@@ -17,9 +17,9 @@ internal Characteristic(
FallbackValue = fallbackValue;
}
- public Func Resolver { get; }
+ private Func Resolver { get; }
- public new T FallbackValue { get; }
+ public T FallbackValue { get; }
public new T this[CharacteristicObject obj]
{
diff --git a/src/BenchmarkDotNet/Columns/BaselineScaledColumn.cs b/src/BenchmarkDotNet/Columns/BaselineScaledColumn.cs
index d8671bc541..7ba1b79677 100644
--- a/src/BenchmarkDotNet/Columns/BaselineScaledColumn.cs
+++ b/src/BenchmarkDotNet/Columns/BaselineScaledColumn.cs
@@ -87,7 +87,7 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
}
}
- public bool IsNonBaselinesPrecise(Summary summary, Statistics baselineStat, BenchmarkCase benchmarkCase)
+ private static bool IsNonBaselinesPrecise(Summary summary, Statistics baselineStat, BenchmarkCase benchmarkCase)
{
string logicalGroupKey = summary.GetLogicalGroupKey(benchmarkCase);
var nonBaselines = summary.BenchmarksCases
diff --git a/src/BenchmarkDotNet/Columns/DefaultColumnProvider.cs b/src/BenchmarkDotNet/Columns/DefaultColumnProvider.cs
index bada6bd6a6..a7d0133705 100644
--- a/src/BenchmarkDotNet/Columns/DefaultColumnProvider.cs
+++ b/src/BenchmarkDotNet/Columns/DefaultColumnProvider.cs
@@ -4,16 +4,17 @@
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Mathematics;
using BenchmarkDotNet.Reports;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Columns
{
public static class DefaultColumnProviders
{
- public static readonly IColumnProvider Descriptor = new DescriptorColumnProvider();
- public static readonly IColumnProvider Job = new JobColumnProvider();
- public static readonly IColumnProvider Statistics = new StatisticsColumnProvider();
- public static readonly IColumnProvider Params = new ParamsColumnProvider();
- public static readonly IColumnProvider Diagnosers = new DiagnosersColumnProvider();
+ [PublicAPI] public static readonly IColumnProvider Descriptor = new DescriptorColumnProvider();
+ [PublicAPI] public static readonly IColumnProvider Job = new JobColumnProvider();
+ [PublicAPI] public static readonly IColumnProvider Statistics = new StatisticsColumnProvider();
+ [PublicAPI] public static readonly IColumnProvider Params = new ParamsColumnProvider();
+ [PublicAPI] public static readonly IColumnProvider Diagnosers = new DiagnosersColumnProvider();
public static readonly IColumnProvider[] Instance = { Descriptor, Job, Statistics, Params, Diagnosers };
diff --git a/src/BenchmarkDotNet/Columns/JobCharacteristicColumn.cs b/src/BenchmarkDotNet/Columns/JobCharacteristicColumn.cs
index 2512c7ef0d..5c14a0a978 100644
--- a/src/BenchmarkDotNet/Columns/JobCharacteristicColumn.cs
+++ b/src/BenchmarkDotNet/Columns/JobCharacteristicColumn.cs
@@ -14,7 +14,7 @@ public class JobCharacteristicColumn : IColumn
private readonly Characteristic characteristic;
- public JobCharacteristicColumn(Characteristic characteristic)
+ private JobCharacteristicColumn(Characteristic characteristic)
{
this.characteristic = characteristic;
Id = "Job." + characteristic.Id;
diff --git a/src/BenchmarkDotNet/Columns/SizeUnit.cs b/src/BenchmarkDotNet/Columns/SizeUnit.cs
index faec4c2840..de029bae52 100644
--- a/src/BenchmarkDotNet/Columns/SizeUnit.cs
+++ b/src/BenchmarkDotNet/Columns/SizeUnit.cs
@@ -1,12 +1,15 @@
-using System.Linq;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Columns
{
+ [SuppressMessage("ReSharper", "InconsistentNaming")] // We want to use "KB", "MB", "GB", "TB"
public class SizeUnit
{
- public string Name { get; }
- public string Description { get; }
- public long ByteAmount { get; }
+ [PublicAPI] public string Name { get; }
+ [PublicAPI] public string Description { get; }
+ [PublicAPI] public long ByteAmount { get; }
public SizeUnit(string name, string description, long byteAmount)
{
@@ -15,13 +18,14 @@ public SizeUnit(string name, string description, long byteAmount)
ByteAmount = byteAmount;
}
- public const long BytesInKiloByte = 1024L; // this value MUST NOT be changed
- public static readonly SizeUnit B = new SizeUnit("B", "Byte", 1L);
- public static readonly SizeUnit KB = new SizeUnit("KB", "Kilobyte", BytesInKiloByte);
- public static readonly SizeUnit MB = new SizeUnit("MB", "Megabyte", BytesInKiloByte * BytesInKiloByte);
- public static readonly SizeUnit GB = new SizeUnit("GB", "Gigabyte", BytesInKiloByte * BytesInKiloByte * BytesInKiloByte);
- public static readonly SizeUnit TB = new SizeUnit("TB", "Terabyte", BytesInKiloByte * BytesInKiloByte * BytesInKiloByte * BytesInKiloByte);
- public static readonly SizeUnit[] All = { B, KB, MB, GB, TB };
+ private const long BytesInKiloByte = 1024L; // this value MUST NOT be changed
+
+ [PublicAPI] public static readonly SizeUnit B = new SizeUnit("B", "Byte", 1L);
+ [PublicAPI] public static readonly SizeUnit KB = new SizeUnit("KB", "Kilobyte", BytesInKiloByte);
+ [PublicAPI] public static readonly SizeUnit MB = new SizeUnit("MB", "Megabyte", BytesInKiloByte * BytesInKiloByte);
+ [PublicAPI] public static readonly SizeUnit GB = new SizeUnit("GB", "Gigabyte", BytesInKiloByte * BytesInKiloByte * BytesInKiloByte);
+ [PublicAPI] public static readonly SizeUnit TB = new SizeUnit("TB", "Terabyte", BytesInKiloByte * BytesInKiloByte * BytesInKiloByte * BytesInKiloByte);
+ [PublicAPI] public static readonly SizeUnit[] All = { B, KB, MB, GB, TB };
public static SizeUnit GetBestSizeUnit(params long[] values)
{
diff --git a/src/BenchmarkDotNet/Columns/StatisticColumn.cs b/src/BenchmarkDotNet/Columns/StatisticColumn.cs
index 5afc11c868..a85f9bb0b7 100644
--- a/src/BenchmarkDotNet/Columns/StatisticColumn.cs
+++ b/src/BenchmarkDotNet/Columns/StatisticColumn.cs
@@ -9,7 +9,7 @@ namespace BenchmarkDotNet.Columns
{
public class StatisticColumn : IColumn
{
- public enum Priority
+ private enum Priority
{
Main,
Quartile,
diff --git a/src/BenchmarkDotNet/Configs/ManualConfig.cs b/src/BenchmarkDotNet/Configs/ManualConfig.cs
index 36d7c7b935..05a87aff6f 100644
--- a/src/BenchmarkDotNet/Configs/ManualConfig.cs
+++ b/src/BenchmarkDotNet/Configs/ManualConfig.cs
@@ -13,6 +13,7 @@
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Validators;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Configs
{
@@ -43,15 +44,11 @@ public class ManualConfig : IConfig
public IEnumerable GetLogicalGroupRules() => logicalGroupRules;
- public ConfigUnionRule UnionRule { get; set; } = ConfigUnionRule.Union;
-
- public bool KeepBenchmarkFiles { get; set; }
-
- public bool SummaryPerType { get; set; } = true;
-
- public string ArtifactsPath { get; set; }
-
- public Encoding Encoding { get; set; }
+ [PublicAPI] public ConfigUnionRule UnionRule { get; set; } = ConfigUnionRule.Union;
+ [PublicAPI] public bool KeepBenchmarkFiles { get; set; }
+ [PublicAPI] public bool SummaryPerType { get; set; } = true;
+ [PublicAPI] public string ArtifactsPath { get; set; }
+ [PublicAPI] public Encoding Encoding { get; set; }
public void Add(params IColumn[] newColumns) => columnProviders.AddRange(newColumns.Select(c => c.ToProvider()));
public void Add(params IColumnProvider[] newColumnProviders) => columnProviders.AddRange(newColumnProviders);
@@ -68,6 +65,7 @@ public class ManualConfig : IConfig
public void Set(Encoding encoding) => Encoding = encoding;
public void Add(params BenchmarkLogicalGroupRule[] rules) => logicalGroupRules.AddRange(rules);
+ [PublicAPI]
public void Add(IConfig config)
{
columnProviders.AddRange(config.GetColumnProviders());
diff --git a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs
index 560604d8d7..cae9101a03 100644
--- a/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs
+++ b/src/BenchmarkDotNet/ConsoleArguments/CommandLineOptions.cs
@@ -1,11 +1,15 @@
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.IO;
using BenchmarkDotNet.Mathematics;
using CommandLine;
using CommandLine.Text;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.ConsoleArguments
{
+ [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
+ [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
public class CommandLineOptions
{
[Option('j', "job", Required = false, Default = "Default", HelpText = "Dry/Short/Medium/Long or Default")]
@@ -54,6 +58,7 @@ public class CommandLineOptions
public bool Join { get; set; }
[Usage(ApplicationAlias = "")]
+ [PublicAPI]
public static IEnumerable Examples
{
get
diff --git a/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs b/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs
index 6f5f672775..a7e4cd50a0 100644
--- a/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs
+++ b/src/BenchmarkDotNet/ConsoleArguments/LoggerWrapper.cs
@@ -10,7 +10,7 @@ internal class LoggerWrapper : TextWriter
public LoggerWrapper(ILogger logger) => this.logger = logger;
- public override Encoding Encoding { get; }
+ public override Encoding Encoding { get; } = Encoding.ASCII;
public override void Write(string value) => logger.WriteInfo(value);
}
diff --git a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs
index 3ebe51b36a..0442513848 100644
--- a/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs
+++ b/src/BenchmarkDotNet/Diagnosers/DiagnosersLoader.cs
@@ -15,7 +15,7 @@ internal static class DiagnosersLoader
private const string DiagnosticAssemblyName = "BenchmarkDotNet.Diagnostics.Windows";
// Make the Diagnosers lazy-loaded, so they are only instantiated if needed
- internal static readonly Lazy LazyLoadedDiagnosers
+ private static readonly Lazy LazyLoadedDiagnosers
= new Lazy(LoadDiagnosers, LazyThreadSafetyMode.ExecutionAndPublication);
internal static IDiagnoser GetImplementation() where TDiagnoser : IDiagnoser
diff --git a/src/BenchmarkDotNet/Diagnosers/DisassemblyDiagnoser.cs b/src/BenchmarkDotNet/Diagnosers/DisassemblyDiagnoser.cs
index 6bd8e7255d..67a2ec68f0 100644
--- a/src/BenchmarkDotNet/Diagnosers/DisassemblyDiagnoser.cs
+++ b/src/BenchmarkDotNet/Diagnosers/DisassemblyDiagnoser.cs
@@ -20,7 +20,7 @@ public class DisassemblyDiagnoser : IDisassemblyDiagnoser
private readonly MonoDisassembler monoDisassembler;
private readonly Dictionary results;
- internal DisassemblyDiagnoser(WindowsDisassembler windowsDisassembler, MonoDisassembler monoDisassembler)
+ private DisassemblyDiagnoser(WindowsDisassembler windowsDisassembler, MonoDisassembler monoDisassembler)
{
this.windowsDisassembler = windowsDisassembler;
this.monoDisassembler = monoDisassembler;
@@ -67,7 +67,7 @@ public void Handle(HostSignal signal, DiagnoserActionParameters parameters)
if (signal == HostSignal.AfterAll && ShouldUseWindowsDisassembler(benchmark))
results.Add(benchmark, windowsDisassembler.Disassemble(parameters));
else if (signal == HostSignal.SeparateLogic && ShouldUseMonoDisassembler(benchmark))
- results.Add(benchmark, monoDisassembler.Disassemble(benchmark, benchmark.Job.Environment.Runtime as MonoRuntime));
+ results.Add(benchmark, MonoDisassembler.Disassemble(benchmark, benchmark.Job.Environment.Runtime as MonoRuntime));
}
public void DisplayResults(ILogger logger)
@@ -91,10 +91,10 @@ public IEnumerable Validate(ValidationParameters validationPara
}
}
- private bool ShouldUseMonoDisassembler(BenchmarkCase benchmarkCase)
+ private static bool ShouldUseMonoDisassembler(BenchmarkCase benchmarkCase)
=> benchmarkCase.Job.Environment.Runtime is MonoRuntime || RuntimeInformation.IsMono;
- private bool ShouldUseWindowsDisassembler(BenchmarkCase benchmarkCase)
+ private static bool ShouldUseWindowsDisassembler(BenchmarkCase benchmarkCase)
=> !(benchmarkCase.Job.Environment.Runtime is MonoRuntime) && RuntimeInformation.IsWindows();
}
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Diagnosers/DisassemblyPrettifier.cs b/src/BenchmarkDotNet/Diagnosers/DisassemblyPrettifier.cs
index ef34e284dc..728284b64d 100644
--- a/src/BenchmarkDotNet/Diagnosers/DisassemblyPrettifier.cs
+++ b/src/BenchmarkDotNet/Diagnosers/DisassemblyPrettifier.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -141,7 +142,7 @@ private static string PadRight(string instruction)
private static string WithoutAddress(string extraArguments)
{
- int startOfTheAddress = extraArguments.IndexOf("(");
+ int startOfTheAddress = extraArguments.IndexOf("(", StringComparison.Ordinal);
if (startOfTheAddress < 0)
return extraArguments;
diff --git a/src/BenchmarkDotNet/Diagnosers/IDiagnoser.cs b/src/BenchmarkDotNet/Diagnosers/IDiagnoser.cs
index a0b9ebd85e..018147924a 100644
--- a/src/BenchmarkDotNet/Diagnosers/IDiagnoser.cs
+++ b/src/BenchmarkDotNet/Diagnosers/IDiagnoser.cs
@@ -30,7 +30,7 @@ public interface IDiagnoser
IEnumerable Validate(ValidationParameters validationParameters);
}
- public interface IConfigurableDiagnoser : IDiagnoser
+ public interface IConfigurableDiagnoser : IDiagnoser
{
IConfigurableDiagnoser Configure(TConfig config);
}
diff --git a/src/BenchmarkDotNet/Diagnosers/MemoryDiagnoser.cs b/src/BenchmarkDotNet/Diagnosers/MemoryDiagnoser.cs
index ba8f0b6149..2a78a17a74 100644
--- a/src/BenchmarkDotNet/Diagnosers/MemoryDiagnoser.cs
+++ b/src/BenchmarkDotNet/Diagnosers/MemoryDiagnoser.cs
@@ -12,6 +12,7 @@
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Validators;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Diagnosers
{
@@ -20,7 +21,7 @@ public class MemoryDiagnoser : IDiagnoser
private const int Gen0 = 0, Gen1 = 1, Gen2 = 2;
public static readonly MemoryDiagnoser Default = new MemoryDiagnoser();
- public const string DiagnoserId = nameof(MemoryDiagnoser);
+ private const string DiagnoserId = nameof(MemoryDiagnoser);
private readonly Dictionary results = new Dictionary();
@@ -50,6 +51,7 @@ public void ProcessResults(DiagnoserResults results)
public IEnumerable Validate(ValidationParameters validationParameters)
=> Array.Empty();
+ [PublicAPI]
public class AllocationColumn : IColumn
{
private readonly Dictionary results;
@@ -81,6 +83,7 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase, ISummarySty
}
}
+ [PublicAPI]
public class GCCollectionColumn : IColumn
{
private readonly Dictionary results;
diff --git a/src/BenchmarkDotNet/Diagnosers/MonoDisassembler.cs b/src/BenchmarkDotNet/Diagnosers/MonoDisassembler.cs
index 963542a49c..3a54914505 100644
--- a/src/BenchmarkDotNet/Diagnosers/MonoDisassembler.cs
+++ b/src/BenchmarkDotNet/Diagnosers/MonoDisassembler.cs
@@ -27,7 +27,7 @@ internal MonoDisassembler(DisassemblyDiagnoserConfig config)
recursiveDepth = config.RecursiveDepth;
}
- internal DisassemblyResult Disassemble(BenchmarkCase benchmarkCase, MonoRuntime mono)
+ internal static DisassemblyResult Disassemble(BenchmarkCase benchmarkCase, MonoRuntime mono)
{
Debug.Assert(mono == null || !RuntimeInformation.IsMono, "Must never be called for Non-Mono benchmarks");
@@ -136,9 +136,9 @@ private static DisassemblyResult CreateErrorResult([ItemCanBeNull] IReadOnlyList
//line example 1: 0: 48 83 ec 28 sub $0x28,%rsp
//line example 2: 0000000000000000 subq $0x28, %rsp
- private static Regex instructionRegex = new Regex(@"\s*(?[0-9a-f]+)(\:\s+([0-9a-f]{2}\s+)+)?\s+(?.*)\s*");
+ private static readonly Regex instructionRegex = new Regex(@"\s*(?[0-9a-f]+)(\:\s+([0-9a-f]{2}\s+)+)?\s+(?.*)\s*");
- public static bool TryParseInstruction(string line, out Code instruction)
+ private static bool TryParseInstruction(string line, out Code instruction)
{
instruction = null;
var match = instructionRegex.Match(line);
diff --git a/src/BenchmarkDotNet/Diagnosers/PreciseMachineCounter.cs b/src/BenchmarkDotNet/Diagnosers/PreciseMachineCounter.cs
index 079df01085..1719898dc4 100644
--- a/src/BenchmarkDotNet/Diagnosers/PreciseMachineCounter.cs
+++ b/src/BenchmarkDotNet/Diagnosers/PreciseMachineCounter.cs
@@ -1,15 +1,16 @@
using System.Collections.Generic;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Diagnosers
{
#pragma warning disable CS3001, CS3003 // ulong is non CLS-compilant
public class PreciseMachineCounter
{
- public int ProfileSourceId { get; }
- public string Name { get; }
- public HardwareCounter Counter { get; }
- public int Interval { get; }
- public Dictionary PerInstructionPointer { get; }
+ [PublicAPI] public int ProfileSourceId { get; }
+ [PublicAPI] public string Name { get; }
+ [PublicAPI] public HardwareCounter Counter { get; }
+ [PublicAPI] public int Interval { get; }
+ [PublicAPI] public Dictionary PerInstructionPointer { get; }
public ulong Count { get; private set; }
diff --git a/src/BenchmarkDotNet/Diagnosers/WindowsDisassembler.cs b/src/BenchmarkDotNet/Diagnosers/WindowsDisassembler.cs
index 6b99c32b98..663689dbe9 100644
--- a/src/BenchmarkDotNet/Diagnosers/WindowsDisassembler.cs
+++ b/src/BenchmarkDotNet/Diagnosers/WindowsDisassembler.cs
@@ -57,7 +57,7 @@ internal DisassemblyResult Disassemble(DiagnoserActionParameters parameters)
}
}
- private string GetDisassemblerPath(Process process, Platform platform)
+ private static string GetDisassemblerPath(Process process, Platform platform)
{
switch (platform)
{
@@ -75,7 +75,7 @@ private string GetDisassemblerPath(Process process, Platform platform)
}
}
- private string GetDisassemblerPath(string architectureName)
+ private static string GetDisassemblerPath(string architectureName)
{
// one can only attach to a process of same target architecture, this is why we need exe for x64 and for x86
string exeName = $"BenchmarkDotNet.Disassembler.{architectureName}.exe";
@@ -102,7 +102,7 @@ private string GetDisassemblerPath(string architectureName)
return disassemblerPath;
}
- private void CopyAllRequiredDependencies(Assembly assemblyWithDisassemblersInResources, string destinationFolder)
+ private static void CopyAllRequiredDependencies(Assembly assemblyWithDisassemblersInResources, string destinationFolder)
{
// ClrMD and Cecil are also embedded in the resources, we need to copy them as well
foreach (string dependency in assemblyWithDisassemblersInResources.GetManifestResourceNames().Where(name => name.EndsWith(".dll")))
@@ -119,7 +119,7 @@ private void CopyAllRequiredDependencies(Assembly assemblyWithDisassemblersInRes
}
}
- private void CopyFromResources(Assembly assembly, string resourceName, string destinationPath)
+ private static void CopyFromResources(Assembly assembly, string resourceName, string destinationPath)
{
using (var resourceStream = assembly.GetManifestResourceStream(resourceName))
using (var exeStream = File.Create(destinationPath))
@@ -143,7 +143,7 @@ private string BuildArguments(DiagnoserActionParameters parameters, string resul
.ToString();
// code copied from https://stackoverflow.com/a/33206186/5852046
- internal static class NativeMethods
+ private static class NativeMethods
{
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms684139%28v=vs.85%29.aspx
public static bool Is64Bit(Process process)
diff --git a/src/BenchmarkDotNet/Engines/Engine.cs b/src/BenchmarkDotNet/Engines/Engine.cs
index edf248333c..865044ad60 100644
--- a/src/BenchmarkDotNet/Engines/Engine.cs
+++ b/src/BenchmarkDotNet/Engines/Engine.cs
@@ -16,20 +16,20 @@ public class Engine : IEngine
{
public const int MinInvokeCount = 4;
- public IHost Host { get; }
- public Action WorkloadAction { get; }
- public Action Dummy1Action { get; }
- public Action Dummy2Action { get; }
- public Action Dummy3Action { get; }
- public Action OverheadAction { get; }
- public Job TargetJob { get; }
- public long OperationsPerInvoke { get; }
- public Action GlobalSetupAction { get; }
- public Action GlobalCleanupAction { get; }
- public Action IterationSetupAction { get; }
- public Action IterationCleanupAction { get; }
- public IResolver Resolver { get; }
- public Encoding Encoding { get; }
+ [PublicAPI] public IHost Host { get; }
+ [PublicAPI] public Action WorkloadAction { get; }
+ [PublicAPI] public Action Dummy1Action { get; }
+ [PublicAPI] public Action Dummy2Action { get; }
+ [PublicAPI] public Action Dummy3Action { get; }
+ [PublicAPI] public Action OverheadAction { get; }
+ [PublicAPI] public Job TargetJob { get; }
+ [PublicAPI] public long OperationsPerInvoke { get; }
+ [PublicAPI] public Action GlobalSetupAction { get; }
+ [PublicAPI] public Action GlobalCleanupAction { get; }
+ [PublicAPI] public Action IterationSetupAction { get; }
+ [PublicAPI] public Action IterationCleanupAction { get; }
+ [PublicAPI] public IResolver Resolver { get; }
+ [PublicAPI] public Encoding Encoding { get; }
private IClock Clock { get; }
private bool ForceAllocations { get; }
@@ -177,7 +177,7 @@ private void GcCollect()
ForceGcCollect();
}
- private void ForceGcCollect()
+ private static void ForceGcCollect()
{
GC.Collect();
GC.WaitForPendingFinalizers();
@@ -188,7 +188,7 @@ private void ForceGcCollect()
public void WriteLine() => Host.WriteLine();
- private void EnableMonitoring()
+ private static void EnableMonitoring()
{
if (RuntimeInformation.IsMono) // Monitoring is not available in Mono, see http://stackoverflow.com/questions/40234948/how-to-get-the-number-of-allocated-bytes-in-mono
return;
diff --git a/src/BenchmarkDotNet/Engines/EngineGeneralStage.cs b/src/BenchmarkDotNet/Engines/EngineGeneralStage.cs
index 1c30d312d6..15cd3bddd4 100644
--- a/src/BenchmarkDotNet/Engines/EngineGeneralStage.cs
+++ b/src/BenchmarkDotNet/Engines/EngineGeneralStage.cs
@@ -10,8 +10,8 @@ namespace BenchmarkDotNet.Engines
public class EngineActualStage : EngineStage
{
internal const int MaxOverheadIterationCount = 20;
- internal const double MaxOverheadRelativeError = 0.05;
- internal const int DefaultWorkloadCount = 10;
+ private const double MaxOverheadRelativeError = 0.05;
+ private const int DefaultWorkloadCount = 10;
private readonly int? targetCount;
private readonly double maxRelativeError;
diff --git a/src/BenchmarkDotNet/Engines/RunResults.cs b/src/BenchmarkDotNet/Engines/RunResults.cs
index 16e97753be..9553854fb4 100644
--- a/src/BenchmarkDotNet/Engines/RunResults.cs
+++ b/src/BenchmarkDotNet/Engines/RunResults.cs
@@ -13,10 +13,11 @@ public struct RunResults
{
private readonly OutlierMode outlierMode;
private readonly Encoding encoding;
- [CanBeNull]
+
+ [CanBeNull, PublicAPI]
public IReadOnlyList Overhead { get; }
- [NotNull]
+ [NotNull, PublicAPI]
public IReadOnlyList Workload { get; }
public GcStats GCStats { get; }
diff --git a/src/BenchmarkDotNet/Environments/BenchmarkEnvironmentInfo.cs b/src/BenchmarkDotNet/Environments/BenchmarkEnvironmentInfo.cs
index 4946979e89..63dc9825bf 100644
--- a/src/BenchmarkDotNet/Environments/BenchmarkEnvironmentInfo.cs
+++ b/src/BenchmarkDotNet/Environments/BenchmarkEnvironmentInfo.cs
@@ -6,6 +6,7 @@
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Portability;
using BenchmarkDotNet.Validators;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Environments
{
@@ -14,23 +15,15 @@ public class BenchmarkEnvironmentInfo
internal const string RuntimeInfoPrefix = "Runtime=";
internal const string GcInfoPrefix = "GC=";
- public string Architecture { get; protected set; }
-
- public string Configuration { get; protected set; }
-
- public string RuntimeVersion { get; protected set; }
-
- public bool HasAttachedDebugger { get; protected set; }
-
- public bool HasRyuJit { get; protected set; }
-
- public string JitInfo { get; protected set; }
-
- public bool IsServerGC { get; protected set; }
-
- public bool IsConcurrentGC { get; protected set; }
-
- public long GCAllocationQuantum { get; protected set; }
+ [PublicAPI] public string Architecture { get; protected set; }
+ [PublicAPI] public string Configuration { get; protected set; }
+ [PublicAPI] public string RuntimeVersion { get; protected set; }
+ [PublicAPI] public bool HasAttachedDebugger { get; protected set; }
+ [PublicAPI] public bool HasRyuJit { get; protected set; }
+ [PublicAPI] public string JitInfo { get; protected set; }
+ [PublicAPI] public bool IsServerGC { get; protected set; }
+ [PublicAPI] public bool IsConcurrentGC { get; protected set; }
+ [PublicAPI] public long GCAllocationQuantum { get; protected set; }
protected BenchmarkEnvironmentInfo()
{
@@ -55,15 +48,13 @@ public virtual IEnumerable ToFormattedString()
yield return $"{GcInfoPrefix}{GetGcConcurrentFlag()} {GetGcServerFlag()}";
}
- protected string GetConfigurationFlag() => Configuration == RuntimeInformation.Unknown || Configuration == RuntimeInformation.ReleaseConfigurationName
+ [PublicAPI] protected string GetConfigurationFlag() => Configuration == RuntimeInformation.Unknown || Configuration == RuntimeInformation.ReleaseConfigurationName
? ""
: Configuration;
- protected string GetDebuggerFlag() => HasAttachedDebugger ? " [AttachedDebugger]" : "";
-
- protected string GetGcServerFlag() => IsServerGC ? "Server" : "Workstation";
-
- protected string GetGcConcurrentFlag() => IsConcurrentGC ? "Concurrent" : "Non-concurrent";
+ [PublicAPI] protected string GetDebuggerFlag() => HasAttachedDebugger ? " [AttachedDebugger]" : "";
+ [PublicAPI] protected string GetGcServerFlag() => IsServerGC ? "Server" : "Workstation";
+ [PublicAPI] protected string GetGcConcurrentFlag() => IsConcurrentGC ? "Concurrent" : "Non-concurrent";
internal string GetRuntimeInfo()
{
diff --git a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
index defb903401..a24475e205 100644
--- a/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
+++ b/src/BenchmarkDotNet/Environments/HostEnvironmentInfo.cs
@@ -53,17 +53,17 @@ public class HostEnvironmentInfo : BenchmarkEnvironmentInfo
/// checks if Mono is installed
/// It's expensive to call (creates new process by calling `mono --version`)
///
- public Lazy IsMonoInstalled { get; protected set; }
+ public Lazy IsMonoInstalled { get; }
///
/// The frequency of the timer as the number of ticks per second.
///
- public Frequency ChronometerFrequency { get; protected set; }
- public TimeInterval ChronometerResolution => ChronometerFrequency.ToResolution();
+ [PublicAPI] public Frequency ChronometerFrequency { get; protected set; }
+ [PublicAPI] public TimeInterval ChronometerResolution => ChronometerFrequency.ToResolution();
public HardwareTimerKind HardwareTimerKind { get; protected set; }
- public Lazy> AntivirusProducts { get; protected set; }
+ public Lazy> AntivirusProducts { get; }
public Lazy VirtualMachineHypervisor { get; protected set; }
diff --git a/src/BenchmarkDotNet/Environments/Runtime.cs b/src/BenchmarkDotNet/Environments/Runtime.cs
index 4d309815e6..d23fc3ca35 100644
--- a/src/BenchmarkDotNet/Environments/Runtime.cs
+++ b/src/BenchmarkDotNet/Environments/Runtime.cs
@@ -1,4 +1,5 @@
using System;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Environments
{
@@ -27,7 +28,7 @@ public abstract class Runtime : IEquatable
///
public static readonly Runtime CoreRT = new CoreRtRuntime();
- public string Name { get; }
+ [PublicAPI] public string Name { get; }
protected Runtime(string name) => Name = name;
diff --git a/src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs b/src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs
index 4696ae09bb..e368468ba9 100644
--- a/src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs
+++ b/src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs
@@ -107,6 +107,6 @@ private void PrintTable(BenchmarkCase[] benchmarksCase, ILogger logger, string t
logger.WriteLine("");
}
- private string GetImportantInfo(BenchmarkReport benchmarkReport) => benchmarkReport.GetRuntimeInfo();
+ private static string GetImportantInfo(BenchmarkReport benchmarkReport) => benchmarkReport.GetRuntimeInfo();
}
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Exporters/Csv/CsvExporter.cs b/src/BenchmarkDotNet/Exporters/Csv/CsvExporter.cs
index ecbaecd938..6a7f38e1eb 100644
--- a/src/BenchmarkDotNet/Exporters/Csv/CsvExporter.cs
+++ b/src/BenchmarkDotNet/Exporters/Csv/CsvExporter.cs
@@ -1,5 +1,6 @@
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Exporters.Csv
{
@@ -15,7 +16,7 @@ public CsvExporter(CsvSeparator separator) : this (separator, SummaryStyle.Defau
{
}
- public CsvExporter(CsvSeparator separator, ISummaryStyle style)
+ [PublicAPI] public CsvExporter(CsvSeparator separator, ISummaryStyle style)
{
this.style = style;
this.separator = separator;
diff --git a/src/BenchmarkDotNet/Exporters/Csv/CsvMeasurementsExporter.cs b/src/BenchmarkDotNet/Exporters/Csv/CsvMeasurementsExporter.cs
index dbb488259e..2c99a3e5fe 100644
--- a/src/BenchmarkDotNet/Exporters/Csv/CsvMeasurementsExporter.cs
+++ b/src/BenchmarkDotNet/Exporters/Csv/CsvMeasurementsExporter.cs
@@ -7,6 +7,7 @@
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Exporters.Csv
{
@@ -32,7 +33,7 @@ public CsvMeasurementsExporter(CsvSeparator separator, ISummaryStyle style = nul
protected override string FileCaption => "measurements";
- public ISummaryStyle Style { get; private set; }
+ [PublicAPI] public ISummaryStyle Style { get; }
public static Job[] GetJobs(Summary summary) => summary.BenchmarksCases.Select(b => b.Job).ToArray();
diff --git a/src/BenchmarkDotNet/Exporters/DefaultExporters.cs b/src/BenchmarkDotNet/Exporters/DefaultExporters.cs
index db562db3f6..50fbb8714c 100644
--- a/src/BenchmarkDotNet/Exporters/DefaultExporters.cs
+++ b/src/BenchmarkDotNet/Exporters/DefaultExporters.cs
@@ -1,29 +1,30 @@
using BenchmarkDotNet.Exporters.Csv;
using BenchmarkDotNet.Exporters.Json;
using BenchmarkDotNet.Exporters.Xml;
+using JetBrains.Annotations;
namespace BenchmarkDotNet.Exporters
{
public static class DefaultExporters
{
- public static IExporter AsciiDoc = AsciiDocExporter.Default;
- public static IExporter Csv = CsvExporter.Default;
- public static IExporter CsvMeasurements = CsvMeasurementsExporter.Default;
- public static IExporter Html = HtmlExporter.Default;
- public static IExporter Markdown = MarkdownExporter.Default;
- public static IExporter Plain = PlainExporter.Default;
- public static IExporter RPlot = RPlotExporter.Default;
+ [PublicAPI] public static readonly IExporter AsciiDoc = AsciiDocExporter.Default;
+ [PublicAPI] public static readonly IExporter Csv = CsvExporter.Default;
+ [PublicAPI] public static readonly IExporter CsvMeasurements = CsvMeasurementsExporter.Default;
+ [PublicAPI] public static readonly IExporter Html = HtmlExporter.Default;
+ [PublicAPI] public static readonly IExporter Markdown = MarkdownExporter.Default;
+ [PublicAPI] public static readonly IExporter Plain = PlainExporter.Default;
+ [PublicAPI] public static readonly IExporter RPlot = RPlotExporter.Default;
- public static IExporter Json = JsonExporter.Default;
- public static IExporter JsonBrief = JsonExporter.Brief;
- public static IExporter JsonBriefCompressed = JsonExporter.BriefCompressed;
- public static IExporter JsonFull = JsonExporter.Full;
- public static IExporter JsonFullCompressed = JsonExporter.FullCompressed;
+ [PublicAPI] public static readonly IExporter Json = JsonExporter.Default;
+ [PublicAPI] public static readonly IExporter JsonBrief = JsonExporter.Brief;
+ [PublicAPI] public static readonly IExporter JsonBriefCompressed = JsonExporter.BriefCompressed;
+ [PublicAPI] public static readonly IExporter JsonFull = JsonExporter.Full;
+ [PublicAPI] public static readonly IExporter JsonFullCompressed = JsonExporter.FullCompressed;
- public static IExporter Xml = XmlExporter.Default;
- public static IExporter XmlBrief = XmlExporter.Brief;
- public static IExporter XmlBriefCompressed = XmlExporter.BriefCompressed;
- public static IExporter XmlFull = XmlExporter.Full;
- public static IExporter XmlFullCompressed = XmlExporter.FullCompressed;
+ [PublicAPI] public static readonly IExporter Xml = XmlExporter.Default;
+ [PublicAPI] public static readonly IExporter XmlBrief = XmlExporter.Brief;
+ [PublicAPI] public static readonly IExporter XmlBriefCompressed = XmlExporter.BriefCompressed;
+ [PublicAPI] public static readonly IExporter XmlFull = XmlExporter.Full;
+ [PublicAPI] public static readonly IExporter XmlFullCompressed = XmlExporter.FullCompressed;
}
}
\ No newline at end of file
diff --git a/src/BenchmarkDotNet/Exporters/ExporterBase.cs b/src/BenchmarkDotNet/Exporters/ExporterBase.cs
index 89774b00dc..f7efe932aa 100644
--- a/src/BenchmarkDotNet/Exporters/ExporterBase.cs
+++ b/src/BenchmarkDotNet/Exporters/ExporterBase.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Reports;
@@ -13,7 +12,6 @@ namespace BenchmarkDotNet.Exporters
public abstract class ExporterBase : IExporter
{
public string Name => $"{GetType().Name}{FileNameSuffix}";
- public Encoding Encoding { get; }
protected virtual string FileExtension => "txt";
protected virtual string FileNameSuffix => string.Empty;
diff --git a/src/BenchmarkDotNet/Exporters/HtmlExporter.cs b/src/BenchmarkDotNet/Exporters/HtmlExporter.cs
index cc6b890a95..b8c2bbdab5 100644
--- a/src/BenchmarkDotNet/Exporters/HtmlExporter.cs
+++ b/src/BenchmarkDotNet/Exporters/HtmlExporter.cs
@@ -45,7 +45,7 @@ public override void ExportToLog(Summary summary, ILogger logger)
logger.WriteLine("