From 5107b226fef8faa66636e0a42efebdae37041f01 Mon Sep 17 00:00:00 2001 From: Christiano Donke Date: Fri, 19 Feb 2021 14:24:37 -0300 Subject: [PATCH 01/21] Adding new Attribute --- .../Attributes/BenchmarkNameAttribute.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs diff --git a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs new file mode 100644 index 0000000000..0c31ad064c --- /dev/null +++ b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BenchmarkDotNet.Attributes +{ + [AttributeUsage(AttributeTargets.Class)] + public class BenchmarkNameAttribute : Attribute + { + public BenchmarkNameAttribute(){ } + public BenchmarkNameAttribute(string name) + => Name = name; + + public string Name { get; set; } + } +} From f96a5a41359a58a997a03a0ccf6a681fccede928 Mon Sep 17 00:00:00 2001 From: Christiano Donke Date: Fri, 19 Feb 2021 14:24:50 -0300 Subject: [PATCH 02/21] Sample applying new attribute --- .../IntroRenameTest.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 samples/BenchmarkDotNet.Samples/IntroRenameTest.cs diff --git a/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs b/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs new file mode 100644 index 0000000000..67c9946ac4 --- /dev/null +++ b/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs @@ -0,0 +1,22 @@ +using BenchmarkDotNet.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace BenchmarkDotNet.Samples +{ + [BenchmarkName("Used to be 'IntroRenameTest', now is 'My Renamed Test'")] + public class IntroRenameTest + { + // And define a method with the Benchmark attribute + [Benchmark] + public void Sleep() => Thread.Sleep(10); + + // You can write a description for your method. + [Benchmark(Description = "Thread.Sleep(10)")] + public void SleepWithDescription() => Thread.Sleep(10); + } +} From 23542d4a78b25b91d0bbde955fdabc0ed44cfd8c Mon Sep 17 00:00:00 2001 From: Christiano Donke Date: Fri, 19 Feb 2021 15:29:20 -0300 Subject: [PATCH 03/21] Change the DisplayName extension to show the custom attribute name value --- src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs index cf1f71a166..bdc21506d6 100644 --- a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs @@ -102,6 +102,10 @@ private static IEnumerable GetNestedTypeNames(Type type, bool includeGen /// private static string GetDisplayName(this TypeInfo typeInfo) { + var customAttr = typeInfo.GetCustomAttribute(); + if (customAttr != null) + return customAttr.Name; + if (!typeInfo.IsGenericType) return typeInfo.Name; From d17ce13b862128e83ec96c8edd009676266268d6 Mon Sep 17 00:00:00 2001 From: Christiano Donke Date: Fri, 19 Feb 2021 15:34:18 -0300 Subject: [PATCH 04/21] Tests --- ...aseline_RenameJob_MethodsJobs.approved.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterApprovalTests.GroupExporterTest.JobBaseline_RenameJob_MethodsJobs.approved.txt diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterApprovalTests.GroupExporterTest.JobBaseline_RenameJob_MethodsJobs.approved.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterApprovalTests.GroupExporterTest.JobBaseline_RenameJob_MethodsJobs.approved.txt new file mode 100644 index 0000000000..e8edaa833f --- /dev/null +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterApprovalTests.GroupExporterTest.JobBaseline_RenameJob_MethodsJobs.approved.txt @@ -0,0 +1,20 @@ +=== JobBaseline_RenameJob_MethodsJobs === + +BenchmarkDotNet=v0.10.x-mock, OS=Microsoft Windows NT 10.0.x.mock, VM=Hyper-V +MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores +Frequency=2531248 Hz, Resolution=395.0620 ns, Timer=TSC + [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION + Job1 : extra output line + Job2 : extra output line + + + Method | Job | Mean | Error | StdDev | Rank | LogicalGroup | Baseline | +------- |----- |---------:|--------:|--------:|-----:|------------- |--------- | + Base | Job1 | 102.0 ns | 6.09 ns | 1.58 ns | 1 | * | No | + Foo | Job1 | 202.0 ns | 6.09 ns | 1.58 ns | 2 | * | No | + Bar | Job1 | 302.0 ns | 6.09 ns | 1.58 ns | 3 | * | No | + Base | Job2 | 402.0 ns | 6.09 ns | 1.58 ns | 4 | * | No | + Foo | Job2 | 502.0 ns | 6.09 ns | 1.58 ns | 5 | * | No | + Bar | Job2 | 602.0 ns | 6.09 ns | 1.58 ns | 6 | * | No | + +Errors: 0 From 01a07d73a8e2b89d893db3195b2c6e402d7a9c8b Mon Sep 17 00:00:00 2001 From: Christiano Donke Date: Fri, 19 Feb 2021 15:34:48 -0300 Subject: [PATCH 05/21] Tests --- .../Exporters/MarkdownExporterVerifyTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index 950f8498f8..95aa254774 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -195,6 +195,16 @@ [Benchmark] public void Bar() { } /* JobBaseline */ + [RankColumn, LogicalGroupColumn, BaselineColumn] + [SimpleJob(id: "Job1"), SimpleJob(id: "Job2")] + [BenchmarkDotNet.Attributes.BenchmarkName(Name = "MyRenamedTestCase")] + public class JobBaseline_RenameJob_MethodsJobs + { + [Benchmark] public void Base() { } + [Benchmark] public void Foo() { } + [Benchmark] public void Bar() { } + } + [RankColumn, LogicalGroupColumn, BaselineColumn] [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] public class JobBaseline_MethodsJobs From 1a778a3ceba8c1dc6360059fc1840c4bc484528e Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Wed, 26 Jul 2023 19:49:02 +0200 Subject: [PATCH 06/21] Renaming BenchmarkName attribute to BenchmarkDescription --- .../Attributes/BenchmarkDescriptionAttribute.cs | 16 ++++++++++++++++ .../Attributes/BenchmarkNameAttribute.cs | 16 ---------------- .../Extensions/ReflectionExtensions.cs | 4 ++-- .../Exporters/MarkdownExporterVerifyTests.cs | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs delete mode 100644 src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs diff --git a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs new file mode 100644 index 0000000000..fdf31e82e2 --- /dev/null +++ b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace BenchmarkDotNet.Attributes +{ + [AttributeUsage(AttributeTargets.Class)] + public class BenchmarkDescriptionAttribute : Attribute + { + public BenchmarkDescriptionAttribute(){ } + public BenchmarkDescriptionAttribute(string description) + => Description = description; + + public string Description { get; set; } + } +} diff --git a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs deleted file mode 100644 index 0c31ad064c..0000000000 --- a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkNameAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace BenchmarkDotNet.Attributes -{ - [AttributeUsage(AttributeTargets.Class)] - public class BenchmarkNameAttribute : Attribute - { - public BenchmarkNameAttribute(){ } - public BenchmarkNameAttribute(string name) - => Name = name; - - public string Name { get; set; } - } -} diff --git a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs index bdc21506d6..5ce60cbe85 100644 --- a/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs +++ b/src/BenchmarkDotNet/Extensions/ReflectionExtensions.cs @@ -102,9 +102,9 @@ private static IEnumerable GetNestedTypeNames(Type type, bool includeGen /// private static string GetDisplayName(this TypeInfo typeInfo) { - var customAttr = typeInfo.GetCustomAttribute(); + var customAttr = typeInfo.GetCustomAttribute(); if (customAttr != null) - return customAttr.Name; + return customAttr.Description; if (!typeInfo.IsGenericType) return typeInfo.Name; diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index 95aa254774..e086e6faec 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -197,7 +197,7 @@ [Benchmark] public void Bar() { } [RankColumn, LogicalGroupColumn, BaselineColumn] [SimpleJob(id: "Job1"), SimpleJob(id: "Job2")] - [BenchmarkDotNet.Attributes.BenchmarkName(Name = "MyRenamedTestCase")] + [BenchmarkDotNet.Attributes.BenchmarkDescription(Description = "MyRenamedTestCase")] public class JobBaseline_RenameJob_MethodsJobs { [Benchmark] public void Base() { } From c4d89ca824f17628d9a476abaedea6a5d2ece292 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 27 Jul 2023 18:28:55 +0200 Subject: [PATCH 07/21] Fixing samples/BenchmarkDotNet.Samples/IntroRenameTest.cs --- samples/BenchmarkDotNet.Samples/IntroRenameTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs b/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs index 67c9946ac4..525e16f1dc 100644 --- a/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs +++ b/samples/BenchmarkDotNet.Samples/IntroRenameTest.cs @@ -8,7 +8,7 @@ namespace BenchmarkDotNet.Samples { - [BenchmarkName("Used to be 'IntroRenameTest', now is 'My Renamed Test'")] + [BenchmarkDescription("Used to be 'IntroRenameTest', now is 'My Renamed Test'")] public class IntroRenameTest { // And define a method with the Benchmark attribute From 5282284b02833af034d8735861d2e005ccf7eb19 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 27 Jul 2023 21:43:02 +0200 Subject: [PATCH 08/21] Editing src/BenchmarkDotNet/Running/BenchmarkConverter.cs for the adaptive description and removing only methods attribute from BenchmarkDescriptionAttribute --- .../Attributes/BenchmarkDescriptionAttribute.cs | 1 - src/BenchmarkDotNet/Running/BenchmarkConverter.cs | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs index fdf31e82e2..e5905c62c0 100644 --- a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs +++ b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs @@ -4,7 +4,6 @@ namespace BenchmarkDotNet.Attributes { - [AttributeUsage(AttributeTargets.Class)] public class BenchmarkDescriptionAttribute : Attribute { public BenchmarkDescriptionAttribute(){ } diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index dbe350b2c8..b13985b42d 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -127,8 +127,10 @@ private static IEnumerable GetTargets( GetTargetedMatchingMethod(methodInfo, iterationSetupMethods), GetTargetedMatchingMethod(methodInfo, iterationCleanupMethods), methodInfo.ResolveAttribute(), + type.ResolveAttribute(), + methodInfo.ResolveAttribute(), targetMethods, - config)); + config)) ; } private static MethodInfo GetTargetedMatchingMethod(MethodInfo benchmarkMethod, Tuple[] methods) @@ -155,10 +157,13 @@ private static Descriptor CreateDescriptor( MethodInfo iterationSetupMethod, MethodInfo iterationCleanupMethod, BenchmarkAttribute attr, + BenchmarkDescriptionAttribute descClass, + BenchmarkDescriptionAttribute descMethod, MethodInfo[] targetMethods, IConfig config) { var categoryDiscoverer = config.CategoryDiscoverer ?? DefaultCategoryDiscoverer.Instance; + var description = attr.Description ?? descMethod.Description ?? descClass.Description ?? methodInfo.Name; var target = new Descriptor( type, methodInfo, @@ -166,7 +171,7 @@ private static Descriptor CreateDescriptor( globalCleanupMethod, iterationSetupMethod, iterationCleanupMethod, - attr.Description, + description, baseline: attr.Baseline, categories: categoryDiscoverer.GetCategories(methodInfo), operationsPerInvoke: attr.OperationsPerInvoke, From c9b03625c6458986abd56a9db55f2de6f6ce8e6b Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 27 Jul 2023 21:44:10 +0200 Subject: [PATCH 09/21] Adding tests for situations with overridable description of benchmark --- .../DescriptorNameDescriptionOverrideTests.cs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs diff --git a/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs new file mode 100644 index 0000000000..6c9a7f8382 --- /dev/null +++ b/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs @@ -0,0 +1,41 @@ +using BenchmarkDotNet.Attributes; + +namespace BenchmarkDotNet.Tests.Exporters +{ + internal class DescriptorNameDescriptionOverrideTests + { + public class MethodDescriptionOverrideTests + { + [Benchmark] + public void VoidTest() { } + + [Benchmark(Description = "from Benchmark")] + public void BenchmarkAttributeOverride() { } + + [Benchmark] + [BenchmarkDescription("OverrideFromAttribute")] + public void BenchmarkDescriptionAttributeOverride() { } + + [Benchmark(Description = "Who are the winner?")] + [BenchmarkDescription("OverrideFromAttribute")] + public void BothAttributeOverride() { } + } + [BenchmarkDescription("FromClassDescription")] + public class ClassDescriptionOverrideTests + { + [Benchmark] + public void VoidTest() { } + + [Benchmark(Description = "from Benchmark")] + public void ClassBenchmarkAttributeOverride() { } + + [Benchmark] + [BenchmarkDescription("OverrideFromAttribute")] + public void ClassBenchmarkDescriptionAttributeOverride() { } + + [Benchmark(Description = "Who are the winner?")] + [BenchmarkDescription("OverrideFromAttribute")] + public void ClassBothAttributeOverride() { } + } + } +} From a5eacc38d1fec82a6b500f1e60d08a55567a8ea3 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Fri, 28 Jul 2023 09:14:00 +0200 Subject: [PATCH 10/21] Fixing DescriptorNameDescriptionTests --- .../DescriptorNameDescriptionOverrideTests.cs | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs index 6c9a7f8382..dd7d80ac1e 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs @@ -1,4 +1,6 @@ using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Running; +using Xunit; namespace BenchmarkDotNet.Tests.Exporters { @@ -10,15 +12,30 @@ public class MethodDescriptionOverrideTests public void VoidTest() { } [Benchmark(Description = "from Benchmark")] - public void BenchmarkAttributeOverride() { } + public void BenchmarkAttributeOverride() + { + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("OverrideFromBenchmarkAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } [Benchmark] [BenchmarkDescription("OverrideFromAttribute")] - public void BenchmarkDescriptionAttributeOverride() { } + public void BenchmarkDescriptionAttributeOverride() + { + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("OverrideFromBenchmarkDescriptionMethod", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } [Benchmark(Description = "Who are the winner?")] [BenchmarkDescription("OverrideFromAttribute")] - public void BothAttributeOverride() { } + public void BothAttributeOverride() + { + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("OverrideFromBothAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } } [BenchmarkDescription("FromClassDescription")] public class ClassDescriptionOverrideTests @@ -27,15 +44,27 @@ public class ClassDescriptionOverrideTests public void VoidTest() { } [Benchmark(Description = "from Benchmark")] - public void ClassBenchmarkAttributeOverride() { } + public void ClassBenchmarkAttributeOverride(){ + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("ClassOverrideFromBenchmarkAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } [Benchmark] [BenchmarkDescription("OverrideFromAttribute")] - public void ClassBenchmarkDescriptionAttributeOverride() { } + public void ClassBenchmarkDescriptionAttributeOverride(){ + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("ClassOverrideFromBenchmarkDescriptionMethod", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } [Benchmark(Description = "Who are the winner?")] [BenchmarkDescription("OverrideFromAttribute")] - public void ClassBothAttributeOverride() { } + public void ClassBothAttributeOverride(){ + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("ClassOverrideFromBothAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } } } } From c8b795e7f4497d78295594d51e42d90be0a200a5 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Fri, 28 Jul 2023 10:16:05 +0200 Subject: [PATCH 11/21] Transfering tests from DescriptorNameDescriptionOverrideTests to BenchmarkConverterTests and remaking them in a correct way --- .../DescriptorNameDescriptionOverrideTests.cs | 70 ------------------- .../Running/BenchmarkConverterTests.cs | 49 ++++++++++++- 2 files changed, 48 insertions(+), 71 deletions(-) delete mode 100644 tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs diff --git a/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs deleted file mode 100644 index dd7d80ac1e..0000000000 --- a/tests/BenchmarkDotNet.Tests/Exporters/DescriptorNameDescriptionOverrideTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Running; -using Xunit; - -namespace BenchmarkDotNet.Tests.Exporters -{ - internal class DescriptorNameDescriptionOverrideTests - { - public class MethodDescriptionOverrideTests - { - [Benchmark] - public void VoidTest() { } - - [Benchmark(Description = "from Benchmark")] - public void BenchmarkAttributeOverride() - { - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("OverrideFromBenchmarkAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - - [Benchmark] - [BenchmarkDescription("OverrideFromAttribute")] - public void BenchmarkDescriptionAttributeOverride() - { - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("OverrideFromBenchmarkDescriptionMethod", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - - [Benchmark(Description = "Who are the winner?")] - [BenchmarkDescription("OverrideFromAttribute")] - public void BothAttributeOverride() - { - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("OverrideFromBothAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - } - [BenchmarkDescription("FromClassDescription")] - public class ClassDescriptionOverrideTests - { - [Benchmark] - public void VoidTest() { } - - [Benchmark(Description = "from Benchmark")] - public void ClassBenchmarkAttributeOverride(){ - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("ClassOverrideFromBenchmarkAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - - [Benchmark] - [BenchmarkDescription("OverrideFromAttribute")] - public void ClassBenchmarkDescriptionAttributeOverride(){ - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("ClassOverrideFromBenchmarkDescriptionMethod", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - - [Benchmark(Description = "Who are the winner?")] - [BenchmarkDescription("OverrideFromAttribute")] - public void ClassBothAttributeOverride(){ - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - - Assert.Equal("ClassOverrideFromBothAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); - } - } - } -} diff --git a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs index 4eb72b5d59..cfc8175296 100644 --- a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs +++ b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs @@ -1,4 +1,4 @@ -using System; + using System; using System.Linq; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; @@ -212,6 +212,20 @@ public void MethodDeclarationOrderIsPreserved() Assert.Equal(nameof(BAC.C), info.BenchmarksCases[2].Descriptor.WorkloadMethod.Name); } } + [Fact] + public void DescriptorDescriptionNameOverride() + { + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } + [Fact] + public void ClassDescriptorDescriptionNameOverride() + { + var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + + Assert.Equal("ClassOverrideFromAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + } public class BAC { @@ -278,5 +292,38 @@ public class PrivateIterationCleanup [IterationCleanup] private void X() { } [Benchmark] public void A() { } } + public class MethodDescriptionOverrideTests + { + [Benchmark] + public void VoidTest() { } + + [Benchmark(Description = "from Benchmark")] + public void BenchmarkAttributeOverride() {} + + [Benchmark] + [BenchmarkDescription("OverrideFromAttribute")] + public void BenchmarkDescriptionAttributeOverride() { } + + [Benchmark(Description = "Who are the winner?")] + [BenchmarkDescription("OverrideFromAttribute")] + public void BothAttributeOverride() { } + } + [BenchmarkDescription("FromClassDescription")] + public class ClassDescriptionOverrideTests + { + [Benchmark] + public void VoidTest() { } + + [Benchmark(Description = "from Benchmark")] + public void ClassBenchmarkAttributeOverride() { } + + [Benchmark] + [BenchmarkDescription("OverrideFromAttribute")] + public void ClassBenchmarkDescriptionAttributeOverride() { } + + [Benchmark(Description = "Who are the winner?")] + [BenchmarkDescription("OverrideFromAttribute")] + public void ClassBothAttributeOverride() { } + } } } From fc92051d4d9003fcdf05a18a7440daa17fbc26fa Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Mon, 31 Jul 2023 11:56:10 +0200 Subject: [PATCH 12/21] Starting fixing for TypeInfo to work correctly --- .../Columns/TargetMethodColumn.cs | 2 +- .../Running/BenchmarkConverter.cs | 20 ++++++++++++++++--- .../Running/BenchmarkConverterTests.cs | 14 +++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs b/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs index f6bcb3ef31..d0b9da6da7 100644 --- a/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs +++ b/src/BenchmarkDotNet/Columns/TargetMethodColumn.cs @@ -8,7 +8,7 @@ namespace BenchmarkDotNet.Columns public class TargetMethodColumn : IColumn { public static readonly IColumn Namespace = new TargetMethodColumn(Column.Namespace, benchmark => benchmark.Descriptor.Type.Namespace); - public static readonly IColumn Type = new TargetMethodColumn(Column.Type, benchmark => benchmark.Descriptor.Type.GetDisplayName()); + public static readonly IColumn Type = new TargetMethodColumn(Column.Type, benchmark => benchmark.Descriptor.TypeInfo); public static readonly IColumn Method = new TargetMethodColumn(Column.Method, benchmark => benchmark.Descriptor.WorkloadMethodDisplayInfo, true); private readonly Func valueProvider; diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index b13985b42d..d1a13f5bc7 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -119,6 +119,7 @@ private static IEnumerable GetTargets( Tuple[] iterationCleanupMethods, IConfig config) { + var abc = type.GetCustomAttributes(typeof(BenchmarkDescriptionAttribute), false); return targetMethods .Select(methodInfo => CreateDescriptor(type, GetTargetedMatchingMethod(methodInfo, globalSetupMethods), @@ -157,13 +158,26 @@ private static Descriptor CreateDescriptor( MethodInfo iterationSetupMethod, MethodInfo iterationCleanupMethod, BenchmarkAttribute attr, - BenchmarkDescriptionAttribute descClass, - BenchmarkDescriptionAttribute descMethod, + BenchmarkDescriptionAttribute? descClass, + BenchmarkDescriptionAttribute? descMethod, MethodInfo[] targetMethods, IConfig config) { var categoryDiscoverer = config.CategoryDiscoverer ?? DefaultCategoryDiscoverer.Instance; - var description = attr.Description ?? descMethod.Description ?? descClass.Description ?? methodInfo.Name; + string description; + if (attr != null) + description = attr.Description; + else { + if (descMethod != null) + description = descMethod.Description; + else + { + if (descClass != null) + description = descClass.Description; + else + description = methodInfo.Name; + } + } var target = new Descriptor( type, methodInfo, diff --git a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs index cfc8175296..1e82e77b5b 100644 --- a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs +++ b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs @@ -1,4 +1,4 @@ - using System; +using System; using System.Linq; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; @@ -217,14 +217,20 @@ public void DescriptorDescriptionNameOverride() { var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); - Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + Assert.Equal("VoidTest", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("BenchmarkDescriptionAttributeOverride", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } [Fact] public void ClassDescriptorDescriptionNameOverride() { - var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); + var description = BenchmarkConverter.TypeToBenchmarks(typeof(ClassDescriptionOverrideTests)); - Assert.Equal("ClassOverrideFromAttribute", description.BenchmarksCases[0].Descriptor.DisplayInfo); + Assert.Equal("\'FromClassDescription\'", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("BenchmarkDescriptionAttributeOverride", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } public class BAC From 2d4d261f32eab5daaf445465755c0685c7a43280 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Mon, 31 Jul 2023 12:51:45 +0200 Subject: [PATCH 13/21] Ending fixing FromClassDescription test case --- .../Running/BenchmarkConverter.cs | 26 +++++++------------ .../Running/BenchmarkConverterTests.cs | 6 ++--- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index d1a13f5bc7..5f2d814203 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -120,6 +120,7 @@ private static IEnumerable GetTargets( IConfig config) { var abc = type.GetCustomAttributes(typeof(BenchmarkDescriptionAttribute), false); + var classDescriptionAttribute = type.ResolveAttribute(); return targetMethods .Select(methodInfo => CreateDescriptor(type, GetTargetedMatchingMethod(methodInfo, globalSetupMethods), @@ -128,7 +129,7 @@ private static IEnumerable GetTargets( GetTargetedMatchingMethod(methodInfo, iterationSetupMethods), GetTargetedMatchingMethod(methodInfo, iterationCleanupMethods), methodInfo.ResolveAttribute(), - type.ResolveAttribute(), + classDescriptionAttribute, methodInfo.ResolveAttribute(), targetMethods, config)) ; @@ -158,26 +159,17 @@ private static Descriptor CreateDescriptor( MethodInfo iterationSetupMethod, MethodInfo iterationCleanupMethod, BenchmarkAttribute attr, - BenchmarkDescriptionAttribute? descClass, - BenchmarkDescriptionAttribute? descMethod, + BenchmarkDescriptionAttribute? classDescription, + BenchmarkDescriptionAttribute? methodDescription, MethodInfo[] targetMethods, IConfig config) { var categoryDiscoverer = config.CategoryDiscoverer ?? DefaultCategoryDiscoverer.Instance; - string description; - if (attr != null) - description = attr.Description; - else { - if (descMethod != null) - description = descMethod.Description; - else - { - if (descClass != null) - description = descClass.Description; - else - description = methodInfo.Name; - } - } + string description = attr?.Description; + if (description is null) + description = methodDescription?.Description; + if (description is null) + description = classDescription?.Description; var target = new Descriptor( type, methodInfo, diff --git a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs index 1e82e77b5b..709378a68e 100644 --- a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs +++ b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs @@ -219,7 +219,7 @@ public void DescriptorDescriptionNameOverride() Assert.Equal("VoidTest", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); - Assert.Equal("BenchmarkDescriptionAttributeOverride", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } [Fact] @@ -227,9 +227,9 @@ public void ClassDescriptorDescriptionNameOverride() { var description = BenchmarkConverter.TypeToBenchmarks(typeof(ClassDescriptionOverrideTests)); - Assert.Equal("\'FromClassDescription\'", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("FromClassDescription", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); - Assert.Equal("BenchmarkDescriptionAttributeOverride", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); + Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } From 7d91cbb651f3e0f8b6618e23e3c93937b5ed68ac Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Tue, 1 Aug 2023 07:21:10 +0200 Subject: [PATCH 14/21] Fixing some of the problems from PR #2386 --- .../Attributes/BenchmarkDescriptionAttribute.cs | 1 + src/BenchmarkDotNet/Running/BenchmarkConverter.cs | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs index e5905c62c0..1b3aad7f07 100644 --- a/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs +++ b/src/BenchmarkDotNet.Annotations/Attributes/BenchmarkDescriptionAttribute.cs @@ -4,6 +4,7 @@ namespace BenchmarkDotNet.Attributes { + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)] public class BenchmarkDescriptionAttribute : Attribute { public BenchmarkDescriptionAttribute(){ } diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index 5f2d814203..689a9d9e77 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -119,8 +119,7 @@ private static IEnumerable GetTargets( Tuple[] iterationCleanupMethods, IConfig config) { - var abc = type.GetCustomAttributes(typeof(BenchmarkDescriptionAttribute), false); - var classDescriptionAttribute = type.ResolveAttribute(); + return targetMethods .Select(methodInfo => CreateDescriptor(type, GetTargetedMatchingMethod(methodInfo, globalSetupMethods), @@ -129,10 +128,10 @@ private static IEnumerable GetTargets( GetTargetedMatchingMethod(methodInfo, iterationSetupMethods), GetTargetedMatchingMethod(methodInfo, iterationCleanupMethods), methodInfo.ResolveAttribute(), - classDescriptionAttribute, + type.ResolveAttribute(), methodInfo.ResolveAttribute(), targetMethods, - config)) ; + config)); } private static MethodInfo GetTargetedMatchingMethod(MethodInfo benchmarkMethod, Tuple[] methods) @@ -167,7 +166,7 @@ private static Descriptor CreateDescriptor( var categoryDiscoverer = config.CategoryDiscoverer ?? DefaultCategoryDiscoverer.Instance; string description = attr?.Description; if (description is null) - description = methodDescription?.Description; + description ??= methodDescription?.Description; if (description is null) description = classDescription?.Description; var target = new Descriptor( From d58490cdd8292762bbaddd7903faee2620b6241d Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Wed, 2 Aug 2023 14:22:24 +0200 Subject: [PATCH 15/21] Continue fixing --- .../Running/BenchmarkConverter.cs | 10 +- src/BenchmarkDotNet/Running/Descriptor.cs | 2 + ...rifyTests.Exporters_Invariant.verified.txt | 8 +- ...erVerifyTests.Exporters_en-US.verified.txt | 1220 ++++++++--------- .../Running/BenchmarkConverterTests.cs | 21 +- 5 files changed, 630 insertions(+), 631 deletions(-) diff --git a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs index 689a9d9e77..fa2523e1c8 100644 --- a/src/BenchmarkDotNet/Running/BenchmarkConverter.cs +++ b/src/BenchmarkDotNet/Running/BenchmarkConverter.cs @@ -119,7 +119,6 @@ private static IEnumerable GetTargets( Tuple[] iterationCleanupMethods, IConfig config) { - return targetMethods .Select(methodInfo => CreateDescriptor(type, GetTargetedMatchingMethod(methodInfo, globalSetupMethods), @@ -128,7 +127,6 @@ private static IEnumerable GetTargets( GetTargetedMatchingMethod(methodInfo, iterationSetupMethods), GetTargetedMatchingMethod(methodInfo, iterationCleanupMethods), methodInfo.ResolveAttribute(), - type.ResolveAttribute(), methodInfo.ResolveAttribute(), targetMethods, config)); @@ -158,17 +156,15 @@ private static Descriptor CreateDescriptor( MethodInfo iterationSetupMethod, MethodInfo iterationCleanupMethod, BenchmarkAttribute attr, - BenchmarkDescriptionAttribute? classDescription, BenchmarkDescriptionAttribute? methodDescription, MethodInfo[] targetMethods, IConfig config) { var categoryDiscoverer = config.CategoryDiscoverer ?? DefaultCategoryDiscoverer.Instance; + if (attr?.Description != null && methodDescription?.Description != null) + throw new InvalidOperationException($"Benchmark {methodInfo.Name} has 2 descriptions from different attributes"); string description = attr?.Description; - if (description is null) - description ??= methodDescription?.Description; - if (description is null) - description = classDescription?.Description; + description ??= methodDescription?.Description; var target = new Descriptor( type, methodInfo, diff --git a/src/BenchmarkDotNet/Running/Descriptor.cs b/src/BenchmarkDotNet/Running/Descriptor.cs index a7fd0cd7ac..b72db09084 100644 --- a/src/BenchmarkDotNet/Running/Descriptor.cs +++ b/src/BenchmarkDotNet/Running/Descriptor.cs @@ -1,6 +1,8 @@ using System; +using System.Data; using System.Linq; using System.Reflection; +using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Extensions; using BenchmarkDotNet.Helpers; using BenchmarkDotNet.Portability; diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt index 31d5cec733..3bba6b5a75 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt @@ -27,10 +27,10 @@ HtmlExporter MockSummary diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt index 31d5cec733..2bf83d25d9 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt @@ -13,9 +13,9 @@ WarmupCount=15 .... [options="header"] |=== -| Method| Mean| Error| StdDev| P67 -| Foo| 1.000 ns| NA| 0.000 ns| 1.000 ns -| Bar| 1.000 ns| NA| 0.000 ns| 1.000 ns +| Method| Mean| Error| StdDev| P67 +| Foo| 1.000 ns| NA| 0.000 ns| 1.000 ns +| Bar| 1.000 ns| NA| 0.000 ns| 1.000 ns |=== ############################################ HtmlExporter @@ -59,156 +59,156 @@ JsonExporter-brief { "Title":"MockSummary", "HostEnvironmentInfo":{ - "BenchmarkDotNetCaption":"BenchmarkDotNet", - "BenchmarkDotNetVersion":"0.10.x-mock", - "OsVersion":"Microsoft Windows NT 10.0.x.mock", - "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", - "PhysicalProcessorCount":1, - "PhysicalCoreCount":4, - "LogicalCoreCount":8, - "RuntimeVersion":"Clr 4.0.x.mock", - "Architecture":"64mock", - "HasAttachedDebugger":false, - "HasRyuJit":true, - "Configuration":"CONFIGURATION", - "DotNetCliVersion":null, - "ChronometerFrequency":{ - "Hertz":2531248 - }, - "HardwareTimerKind":"Tsc" + "BenchmarkDotNetCaption":"BenchmarkDotNet", + "BenchmarkDotNetVersion":"0.10.x-mock", + "OsVersion":"Microsoft Windows NT 10.0.x.mock", + "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", + "PhysicalProcessorCount":1, + "PhysicalCoreCount":4, + "LogicalCoreCount":8, + "RuntimeVersion":"Clr 4.0.x.mock", + "Architecture":"64mock", + "HasAttachedDebugger":false, + "HasRyuJit":true, + "Configuration":"CONFIGURATION", + "DotNetCliVersion":null, + "ChronometerFrequency":{ + "Hertz":2531248 + }, + "HardwareTimerKind":"Tsc" }, "Benchmarks":[ - { - "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Foo", - "MethodTitle":"Foo", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - } - },{ - "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Bar", - "MethodTitle":"Bar", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - } - } + { + "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Foo", + "MethodTitle":"Foo", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + } + },{ + "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Bar", + "MethodTitle":"Bar", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + } + } ] } ############################################ @@ -221,176 +221,176 @@ JsonExporter-full { "Title":"MockSummary", "HostEnvironmentInfo":{ - "BenchmarkDotNetCaption":"BenchmarkDotNet", - "BenchmarkDotNetVersion":"0.10.x-mock", - "OsVersion":"Microsoft Windows NT 10.0.x.mock", - "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", - "PhysicalProcessorCount":1, - "PhysicalCoreCount":4, - "LogicalCoreCount":8, - "RuntimeVersion":"Clr 4.0.x.mock", - "Architecture":"64mock", - "HasAttachedDebugger":false, - "HasRyuJit":true, - "Configuration":"CONFIGURATION", - "DotNetCliVersion":null, - "ChronometerFrequency":{ - "Hertz":2531248 - }, - "HardwareTimerKind":"Tsc" + "BenchmarkDotNetCaption":"BenchmarkDotNet", + "BenchmarkDotNetVersion":"0.10.x-mock", + "OsVersion":"Microsoft Windows NT 10.0.x.mock", + "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", + "PhysicalProcessorCount":1, + "PhysicalCoreCount":4, + "LogicalCoreCount":8, + "RuntimeVersion":"Clr 4.0.x.mock", + "Architecture":"64mock", + "HasAttachedDebugger":false, + "HasRyuJit":true, + "Configuration":"CONFIGURATION", + "DotNetCliVersion":null, + "ChronometerFrequency":{ + "Hertz":2531248 + }, + "HardwareTimerKind":"Tsc" }, "Benchmarks":[ - { - "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Foo", - "MethodTitle":"Foo", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - }, - "Measurements":[ - { - "IterationMode":"Workload", - "IterationStage":"Result", - "LaunchIndex":1, - "IterationIndex":1, - "Operations":1, - "Nanoseconds":1 - } - ] - },{ - "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Bar", - "MethodTitle":"Bar", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - }, - "Measurements":[ - { - "IterationMode":"Workload", - "IterationStage":"Result", - "LaunchIndex":1, - "IterationIndex":1, - "Operations":1, - "Nanoseconds":1 - } - ] - } + { + "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Foo", + "MethodTitle":"Foo", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + }, + "Measurements":[ + { + "IterationMode":"Workload", + "IterationStage":"Result", + "LaunchIndex":1, + "IterationIndex":1, + "Operations":1, + "Nanoseconds":1 + } + ] + },{ + "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Bar", + "MethodTitle":"Bar", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + }, + "Measurements":[ + { + "IterationMode":"Workload", + "IterationStage":"Result", + "LaunchIndex":1, + "IterationIndex":1, + "Operations":1, + "Nanoseconds":1 + } + ] + } ] } ############################################ @@ -410,10 +410,10 @@ Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 - Method | Mean | Error | StdDev | P67 | + Method | Mean | Error | StdDev | P67 | ------- |---------:|------:|---------:|---------:| - Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | - Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-atlassian ############################################ @@ -429,9 +429,9 @@ Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 {noformat} -||Method || Mean ||Error || StdDev || P67 || -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +||Method || Mean ||Error || StdDev || P67 || +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-console ############################################ @@ -445,10 +445,10 @@ Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 -| Method | Mean | Error | StdDev | P67 | +| Method | Mean | Error | StdDev | P67 | |------- |---------:|------:|---------:|---------:| -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-github ############################################ @@ -464,27 +464,27 @@ Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 ``` -| Method | Mean | Error | StdDev | P67 | +| Method | Mean | Error | StdDev | P67 | |------- |---------:|------:|---------:|---------:| -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-stackoverflow ############################################ - BenchmarkDotNet v0.10.x-mock, Microsoft Windows NT 10.0.x.mock (Hyper-V) - MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores - Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC - [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION - LongRun : extra output line + BenchmarkDotNet v0.10.x-mock, Microsoft Windows NT 10.0.x.mock (Hyper-V) + MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores + Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC + [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION + LongRun : extra output line - Job=LongRun IterationCount=100 LaunchCount=3 - WarmupCount=15 + Job=LongRun IterationCount=100 LaunchCount=3 + WarmupCount=15 - Method | Mean | Error | StdDev | P67 | - ------- |---------:|------:|---------:|---------:| - Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | - Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Method | Mean | Error | StdDev | P67 | + ------- |---------:|------:|---------:|---------:| + Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ PlainExporter ############################################ @@ -521,132 +521,132 @@ XmlExporter-brief MockSummary - BenchmarkDotNet - 0.10.x-mock - Microsoft Windows NT 10.0.x.mock - MockIntel Core i7-6700HQ CPU 2.60GHz - 1 - 4 - 8 - Clr 4.0.x.mock - 64mock - False - True - CONFIGURATION - - 2531248 - - Tsc + BenchmarkDotNet + 0.10.x-mock + Microsoft Windows NT 10.0.x.mock + MockIntel Core i7-6700HQ CPU 2.60GHz + 1 + 4 + 8 + Clr 4.0.x.mock + 64mock + False + True + CONFIGURATION + + 2531248 + + Tsc - - MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Foo - Foo - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Bar - Bar - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - + + MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Foo + Foo + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Bar + Bar + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + ############################################ @@ -660,152 +660,152 @@ XmlExporter-full MockSummary - BenchmarkDotNet - 0.10.x-mock - Microsoft Windows NT 10.0.x.mock - MockIntel Core i7-6700HQ CPU 2.60GHz - 1 - 4 - 8 - Clr 4.0.x.mock - 64mock - False - True - CONFIGURATION - - 2531248 - - Tsc + BenchmarkDotNet + 0.10.x-mock + Microsoft Windows NT 10.0.x.mock + MockIntel Core i7-6700HQ CPU 2.60GHz + 1 + 4 + 8 + Clr 4.0.x.mock + 64mock + False + True + CONFIGURATION + + 2531248 + + Tsc - - MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Foo - Foo - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - Workload - Result - 1 - 1 - 1 - 1 - - - - - MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Bar - Bar - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - Workload - Result - 1 - 1 - 1 - 1 - - - + + MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Foo + Foo + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + Workload + Result + 1 + 1 + 1 + 1 + + + + + MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Bar + Bar + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + Workload + Result + 1 + 1 + 1 + 1 + + + ############################################ diff --git a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs index 709378a68e..5875b48629 100644 --- a/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs +++ b/tests/BenchmarkDotNet.Tests/Running/BenchmarkConverterTests.cs @@ -213,6 +213,11 @@ public void MethodDeclarationOrderIsPreserved() } } [Fact] + public void OnlyOneOfAttributeDescriptionIsUsed() + { + Assert.Throws(() => BenchmarkConverter.TypeToBenchmarks(typeof(BothAttributeDescriptionTests))); + } + [Fact] public void DescriptorDescriptionNameOverride() { var description = BenchmarkConverter.TypeToBenchmarks(typeof(MethodDescriptionOverrideTests)); @@ -220,7 +225,6 @@ public void DescriptorDescriptionNameOverride() Assert.Equal("VoidTest", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); - Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } [Fact] public void ClassDescriptorDescriptionNameOverride() @@ -230,7 +234,6 @@ public void ClassDescriptorDescriptionNameOverride() Assert.Equal("FromClassDescription", description.BenchmarksCases[0].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("\'from Benchmark\'", description.BenchmarksCases[1].Descriptor.WorkloadMethodDisplayInfo); Assert.Equal("OverrideFromAttribute", description.BenchmarksCases[2].Descriptor.WorkloadMethodDisplayInfo); - Assert.Equal("\'Who are the winner?\'", description.BenchmarksCases[3].Descriptor.WorkloadMethodDisplayInfo); } public class BAC @@ -298,6 +301,12 @@ public class PrivateIterationCleanup [IterationCleanup] private void X() { } [Benchmark] public void A() { } } + public class BothAttributeDescriptionTests + { + [Benchmark(Description = "BenchmarkAttributeDescription")] + [BenchmarkDescription("BenchmarkDescriptionAttributeDescription")] + public void BothDescriptionsUsed() { } + } public class MethodDescriptionOverrideTests { [Benchmark] @@ -309,10 +318,6 @@ public void BenchmarkAttributeOverride() {} [Benchmark] [BenchmarkDescription("OverrideFromAttribute")] public void BenchmarkDescriptionAttributeOverride() { } - - [Benchmark(Description = "Who are the winner?")] - [BenchmarkDescription("OverrideFromAttribute")] - public void BothAttributeOverride() { } } [BenchmarkDescription("FromClassDescription")] public class ClassDescriptionOverrideTests @@ -326,10 +331,6 @@ public void ClassBenchmarkAttributeOverride() { } [Benchmark] [BenchmarkDescription("OverrideFromAttribute")] public void ClassBenchmarkDescriptionAttributeOverride() { } - - [Benchmark(Description = "Who are the winner?")] - [BenchmarkDescription("OverrideFromAttribute")] - public void ClassBothAttributeOverride() { } } } } From daaf3ee82b4b208470a8dc0da2911e300ea70abb Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 15:27:19 +0200 Subject: [PATCH 16/21] Fixing tests for methods from multiple types --- .../Exporters/JobBaseline_WithAttribute.cs | 14 +++ .../Exporters/MarkdownExporterVerifyTests.cs | 106 ++++++++++-------- ...yTests.GroupExporterArrayTest.verified.txt | 31 +++++ .../Mocks/MockFactory.cs | 33 +++--- 4 files changed, 122 insertions(+), 62 deletions(-) create mode 100644 tests/BenchmarkDotNet.Tests/Exporters/JobBaseline_WithAttribute.cs create mode 100644 tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt diff --git a/tests/BenchmarkDotNet.Tests/Exporters/JobBaseline_WithAttribute.cs b/tests/BenchmarkDotNet.Tests/Exporters/JobBaseline_WithAttribute.cs new file mode 100644 index 0000000000..0b1aaaf959 --- /dev/null +++ b/tests/BenchmarkDotNet.Tests/Exporters/JobBaseline_WithAttribute.cs @@ -0,0 +1,14 @@ +using BenchmarkDotNet.Attributes; + +namespace BenchmarkDotNet.Tests.Exporters +{ + [RankColumn, LogicalGroupColumn, BaselineColumn] + [SimpleJob(id: "Job1"), SimpleJob(id: "Job2")] + [BenchmarkDescription(Description = "MyRenamedTestCase")] + public class JobBaseline_MethodsJobs_WithAttribute + { + [Benchmark] public void Base() { } + [Benchmark] public void Foo() { } + [Benchmark] public void Bar() { } + } +} diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index e086e6faec..9e5b0baf3d 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -4,23 +4,26 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using BenchmarkDotNet.Exporters; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Tests.Mocks; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Exporters; +using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Tests.Builders; +using BenchmarkDotNet.Tests.Mocks; using BenchmarkDotNet.Validators; using JetBrains.Annotations; using VerifyXunit; -using Xunit; - +using Xunit; +using static BenchmarkDotNet.Tests.Exporters.JobBaseline_MethodsJobs_WithAttribute; +using static BenchmarkDotNet.Tests.Exporters.MarkdownExporterVerifyTests.BaselinesBenchmarks; + namespace BenchmarkDotNet.Tests.Exporters { [Collection("VerifyTests")] [UsesVerify] public class MarkdownExporterVerifyTests : IDisposable - { + { + public Type[] benchmarkTypes = new Type[] { typeof(JobBaseline_MethodsJobs_WithAttribute), typeof(JobBaseline_MethodsJobs) }; private readonly CultureInfo initCulture; public MarkdownExporterVerifyTests() => initCulture = Thread.CurrentThread.CurrentCulture; @@ -32,33 +35,54 @@ public static TheoryData GetGroupBenchmarkTypes() foreach (var type in typeof(BaselinesBenchmarks).GetNestedTypes()) data.Add(type); return data; - } - - [Theory] - [MemberData(nameof(GetGroupBenchmarkTypes))] - public Task GroupExporterTest(Type benchmarkType) - { - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - - var logger = new AccumulationLogger(); - logger.WriteLine("=== " + benchmarkType.Name + " ==="); - - var exporter = MarkdownExporter.Mock; - var summary = MockFactory.CreateSummary(benchmarkType); - exporter.ExportToLog(summary, logger); - - var validator = BaselineValidator.FailOnError; - var errors = validator.Validate(new ValidationParameters(summary.BenchmarksCases, summary.BenchmarksCases.First().Config)).ToList(); - logger.WriteLine(); - logger.WriteLine("Errors: " + errors.Count); - foreach (var error in errors) - logger.WriteLineError("* " + error.Message); - - var settings = VerifySettingsFactory.Create(); - settings.UseTextForParameters(benchmarkType.Name); - return Verifier.Verify(logger.GetLog(), settings); - } - + } + + [Theory] + [MemberData(nameof(GetGroupBenchmarkTypes))] + public Task GroupExporterTest(Type benchmarkType) + { + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + + var logger = new AccumulationLogger(); + logger.WriteLine("=== " + benchmarkType.Name + " ==="); + + var exporter = MarkdownExporter.Mock; + var summary = MockFactory.CreateSummary(benchmarkType); + exporter.ExportToLog(summary, logger); + + var validator = BaselineValidator.FailOnError; + var errors = validator.Validate(new ValidationParameters(summary.BenchmarksCases, summary.BenchmarksCases.First().Config)).ToList(); + logger.WriteLine(); + logger.WriteLine("Errors: " + errors.Count); + foreach (var error in errors) + logger.WriteLineError("* " + error.Message); + + var settings = VerifySettingsFactory.Create(); + settings.UseTextForParameters(benchmarkType.Name); + return Verifier.Verify(logger.GetLog(), settings); + } + [Fact] + public Task GroupExporterArrayTest() + { + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + var logger = new AccumulationLogger(); + logger.WriteLine("=== " + benchmarkTypes + " ==="); + + var exporter = MarkdownExporter.Mock; + var summary = MockFactory.CreateSummary(benchmarkTypes); + exporter.ExportToLog(summary, logger); + + var validator = BaselineValidator.FailOnError; + var errors = validator.Validate(new ValidationParameters(summary.BenchmarksCases, summary.BenchmarksCases.First().Config)).ToList(); + logger.WriteLine(); + logger.WriteLine("Errors: " + errors.Count); + foreach (var error in errors) + logger.WriteLineError("* " + error.Message); + + var settings = VerifySettingsFactory.Create(); + return Verifier.Verify(logger.GetLog(), settings); + } + public void Dispose() => Thread.CurrentThread.CurrentCulture = initCulture; [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -193,21 +217,11 @@ [Benchmark] public void Foo() { } [Benchmark] public void Bar() { } } - /* JobBaseline */ - - [RankColumn, LogicalGroupColumn, BaselineColumn] - [SimpleJob(id: "Job1"), SimpleJob(id: "Job2")] - [BenchmarkDotNet.Attributes.BenchmarkDescription(Description = "MyRenamedTestCase")] - public class JobBaseline_RenameJob_MethodsJobs - { - [Benchmark] public void Base() { } - [Benchmark] public void Foo() { } - [Benchmark] public void Bar() { } - } - + /* JobBaseline */ + [RankColumn, LogicalGroupColumn, BaselineColumn] [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] - public class JobBaseline_MethodsJobs + public class JobBaseline_MethodsJobs { [Benchmark] public void Base() { } [Benchmark] public void Foo() { } diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt new file mode 100644 index 0000000000..2e5dcab0a0 --- /dev/null +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt @@ -0,0 +1,31 @@ +=== System.Type[] === + +BenchmarkDotNet v0.10.x-mock, Microsoft Windows NT 10.0.x.mock (Hyper-V) +MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores +Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC + [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION + Job1 : extra output line + Job2 : extra output line + + + Type | Method | Job | Mean | Error | StdDev | Ratio | RatioSD | Rank | LogicalGroup | Baseline | +------------------------ |------- |----- |-----------:|--------:|--------:|------:|--------:|-----:|----------------------------- |--------- | + MyRenamedTestCase | Base | Job1 | 102.0 ns | 6.09 ns | 1.58 ns | ? | ? | 1 | MyRenamedTestCase.Base | No | + MyRenamedTestCase | Base | Job2 | 402.0 ns | 6.09 ns | 1.58 ns | ? | ? | 2 | MyRenamedTestCase.Base | No | + | | | | | | | | | | | + MyRenamedTestCase | Foo | Job1 | 202.0 ns | 6.09 ns | 1.58 ns | ? | ? | 1 | MyRenamedTestCase.Foo | No | + MyRenamedTestCase | Foo | Job2 | 502.0 ns | 6.09 ns | 1.58 ns | ? | ? | 2 | MyRenamedTestCase.Foo | No | + | | | | | | | | | | | + MyRenamedTestCase | Bar | Job1 | 302.0 ns | 6.09 ns | 1.58 ns | ? | ? | 1 | MyRenamedTestCase.Bar | No | + MyRenamedTestCase | Bar | Job2 | 602.0 ns | 6.09 ns | 1.58 ns | ? | ? | 2 | MyRenamedTestCase.Bar | No | + | | | | | | | | | | | + JobBaseline_MethodsJobs | Base | Job1 | 702.0 ns | 6.09 ns | 1.58 ns | 1.00 | 0.00 | 1 | JobBaseline_MethodsJobs.Base | Yes | + JobBaseline_MethodsJobs | Base | Job2 | 1,002.0 ns | 6.09 ns | 1.58 ns | 1.43 | 0.00 | 2 | JobBaseline_MethodsJobs.Base | No | + | | | | | | | | | | | + JobBaseline_MethodsJobs | Foo | Job1 | 802.0 ns | 6.09 ns | 1.58 ns | 1.00 | 0.00 | 1 | JobBaseline_MethodsJobs.Foo | Yes | + JobBaseline_MethodsJobs | Foo | Job2 | 1,102.0 ns | 6.09 ns | 1.58 ns | 1.37 | 0.00 | 2 | JobBaseline_MethodsJobs.Foo | No | + | | | | | | | | | | | + JobBaseline_MethodsJobs | Bar | Job1 | 902.0 ns | 6.09 ns | 1.58 ns | 1.00 | 0.00 | 1 | JobBaseline_MethodsJobs.Bar | Yes | + JobBaseline_MethodsJobs | Bar | Job2 | 1,202.0 ns | 6.09 ns | 1.58 ns | 1.33 | 0.00 | 2 | JobBaseline_MethodsJobs.Bar | No | + +Errors: 0 diff --git a/tests/BenchmarkDotNet.Tests/Mocks/MockFactory.cs b/tests/BenchmarkDotNet.Tests/Mocks/MockFactory.cs index b51f978edf..159fb00cb0 100644 --- a/tests/BenchmarkDotNet.Tests/Mocks/MockFactory.cs +++ b/tests/BenchmarkDotNet.Tests/Mocks/MockFactory.cs @@ -16,22 +16,23 @@ namespace BenchmarkDotNet.Tests.Mocks { public static class MockFactory - { - public static Summary CreateSummary(Type benchmarkType) - { - var runInfo = BenchmarkConverter.TypeToBenchmarks(benchmarkType); - return new Summary( - "MockSummary", - runInfo.BenchmarksCases.Select((benchmark, index) => CreateReport(benchmark, 5, (index + 1) * 100)).ToImmutableArray(), - new HostEnvironmentInfoBuilder().WithoutDotNetSdkVersion().Build(), - string.Empty, - string.Empty, - TimeSpan.FromMinutes(1), - TestCultureInfo.Instance, - ImmutableArray.Empty, - ImmutableArray.Empty); - } - + { + public static Summary CreateSummary(Type benchmarkType) => CreateSummary(new Type[] { benchmarkType }); + public static Summary CreateSummary(Type[] benchmarkTypes) + { + var runInfos = benchmarkTypes.Select(benchmarkType => BenchmarkConverter.TypeToBenchmarks(benchmarkType)); + return new Summary( + "MockSummary", + runInfos.SelectMany(runInfo => runInfo.BenchmarksCases).Select((benchmark, index) => CreateReport(benchmark, 5, (index + 1) * 100)).ToImmutableArray(), + new HostEnvironmentInfoBuilder().WithoutDotNetSdkVersion().Build(), + string.Empty, + string.Empty, + TimeSpan.FromMinutes(1), + TestCultureInfo.Instance, + ImmutableArray.Empty, + ImmutableArray.Empty); + } + public static Summary CreateSummary(IConfig config) => new Summary( "MockSummary", CreateReports(config), From 711d64ec95f292a2e138692fd106e25a579d74aa Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 16:27:54 +0200 Subject: [PATCH 17/21] Choosing better name for new Markdown test --- .../Exporters/MarkdownExporterVerifyTests.cs | 2 +- ...rterVerifyTests.GroupExporterMultipleTypesTest.verified.txt} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/{MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt => MarkdownExporterVerifyTests.GroupExporterMultipleTypesTest.verified.txt} (100%) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index 9e5b0baf3d..a9c74ada96 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -62,7 +62,7 @@ public Task GroupExporterTest(Type benchmarkType) return Verifier.Verify(logger.GetLog(), settings); } [Fact] - public Task GroupExporterArrayTest() + public Task GroupExporterMultipleTypesTest() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var logger = new AccumulationLogger(); diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterMultipleTypesTest.verified.txt similarity index 100% rename from tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterArrayTest.verified.txt rename to tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/MarkdownExporterVerifyTests.GroupExporterMultipleTypesTest.verified.txt From b56686e8b882f3d1f5fedf1dc94e33d2ad078580 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 17:07:22 +0200 Subject: [PATCH 18/21] Cosmetic changes --- .../Exporters/MarkdownExporterVerifyTests.cs | 11 +- ...rifyTests.Exporters_Invariant.verified.txt | 8 +- ...erVerifyTests.Exporters_en-US.verified.txt | 1220 ++++++++--------- 3 files changed, 620 insertions(+), 619 deletions(-) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index a9c74ada96..fb56180cf1 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -4,17 +4,16 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Configs; using BenchmarkDotNet.Exporters; using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Tests.Builders; using BenchmarkDotNet.Tests.Mocks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Tests.Builders; using BenchmarkDotNet.Validators; using JetBrains.Annotations; using VerifyXunit; using Xunit; -using static BenchmarkDotNet.Tests.Exporters.JobBaseline_MethodsJobs_WithAttribute; using static BenchmarkDotNet.Tests.Exporters.MarkdownExporterVerifyTests.BaselinesBenchmarks; namespace BenchmarkDotNet.Tests.Exporters @@ -23,7 +22,6 @@ namespace BenchmarkDotNet.Tests.Exporters [UsesVerify] public class MarkdownExporterVerifyTests : IDisposable { - public Type[] benchmarkTypes = new Type[] { typeof(JobBaseline_MethodsJobs_WithAttribute), typeof(JobBaseline_MethodsJobs) }; private readonly CultureInfo initCulture; public MarkdownExporterVerifyTests() => initCulture = Thread.CurrentThread.CurrentCulture; @@ -61,9 +59,12 @@ public Task GroupExporterTest(Type benchmarkType) settings.UseTextForParameters(benchmarkType.Name); return Verifier.Verify(logger.GetLog(), settings); } + [Fact] public Task GroupExporterMultipleTypesTest() { + + Type[] benchmarkTypes = new Type[] { typeof(JobBaseline_MethodsJobs_WithAttribute), typeof(JobBaseline_MethodsJobs) }; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var logger = new AccumulationLogger(); logger.WriteLine("=== " + benchmarkTypes + " ==="); diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt index 3bba6b5a75..31d5cec733 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_Invariant.verified.txt @@ -27,10 +27,10 @@ HtmlExporter MockSummary diff --git a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt index 2bf83d25d9..31d5cec733 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt +++ b/tests/BenchmarkDotNet.Tests/Exporters/VerifiedFiles/CommonExporterVerifyTests.Exporters_en-US.verified.txt @@ -13,9 +13,9 @@ WarmupCount=15 .... [options="header"] |=== -| Method| Mean| Error| StdDev| P67 -| Foo| 1.000 ns| NA| 0.000 ns| 1.000 ns -| Bar| 1.000 ns| NA| 0.000 ns| 1.000 ns +| Method| Mean| Error| StdDev| P67 +| Foo| 1.000 ns| NA| 0.000 ns| 1.000 ns +| Bar| 1.000 ns| NA| 0.000 ns| 1.000 ns |=== ############################################ HtmlExporter @@ -59,156 +59,156 @@ JsonExporter-brief { "Title":"MockSummary", "HostEnvironmentInfo":{ - "BenchmarkDotNetCaption":"BenchmarkDotNet", - "BenchmarkDotNetVersion":"0.10.x-mock", - "OsVersion":"Microsoft Windows NT 10.0.x.mock", - "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", - "PhysicalProcessorCount":1, - "PhysicalCoreCount":4, - "LogicalCoreCount":8, - "RuntimeVersion":"Clr 4.0.x.mock", - "Architecture":"64mock", - "HasAttachedDebugger":false, - "HasRyuJit":true, - "Configuration":"CONFIGURATION", - "DotNetCliVersion":null, - "ChronometerFrequency":{ - "Hertz":2531248 - }, - "HardwareTimerKind":"Tsc" + "BenchmarkDotNetCaption":"BenchmarkDotNet", + "BenchmarkDotNetVersion":"0.10.x-mock", + "OsVersion":"Microsoft Windows NT 10.0.x.mock", + "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", + "PhysicalProcessorCount":1, + "PhysicalCoreCount":4, + "LogicalCoreCount":8, + "RuntimeVersion":"Clr 4.0.x.mock", + "Architecture":"64mock", + "HasAttachedDebugger":false, + "HasRyuJit":true, + "Configuration":"CONFIGURATION", + "DotNetCliVersion":null, + "ChronometerFrequency":{ + "Hertz":2531248 + }, + "HardwareTimerKind":"Tsc" }, "Benchmarks":[ - { - "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Foo", - "MethodTitle":"Foo", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - } - },{ - "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Bar", - "MethodTitle":"Bar", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - } - } + { + "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Foo", + "MethodTitle":"Foo", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + } + },{ + "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Bar", + "MethodTitle":"Bar", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + } + } ] } ############################################ @@ -221,176 +221,176 @@ JsonExporter-full { "Title":"MockSummary", "HostEnvironmentInfo":{ - "BenchmarkDotNetCaption":"BenchmarkDotNet", - "BenchmarkDotNetVersion":"0.10.x-mock", - "OsVersion":"Microsoft Windows NT 10.0.x.mock", - "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", - "PhysicalProcessorCount":1, - "PhysicalCoreCount":4, - "LogicalCoreCount":8, - "RuntimeVersion":"Clr 4.0.x.mock", - "Architecture":"64mock", - "HasAttachedDebugger":false, - "HasRyuJit":true, - "Configuration":"CONFIGURATION", - "DotNetCliVersion":null, - "ChronometerFrequency":{ - "Hertz":2531248 - }, - "HardwareTimerKind":"Tsc" + "BenchmarkDotNetCaption":"BenchmarkDotNet", + "BenchmarkDotNetVersion":"0.10.x-mock", + "OsVersion":"Microsoft Windows NT 10.0.x.mock", + "ProcessorName":"MockIntel Core i7-6700HQ CPU 2.60GHz", + "PhysicalProcessorCount":1, + "PhysicalCoreCount":4, + "LogicalCoreCount":8, + "RuntimeVersion":"Clr 4.0.x.mock", + "Architecture":"64mock", + "HasAttachedDebugger":false, + "HasRyuJit":true, + "Configuration":"CONFIGURATION", + "DotNetCliVersion":null, + "ChronometerFrequency":{ + "Hertz":2531248 + }, + "HardwareTimerKind":"Tsc" }, "Benchmarks":[ - { - "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Foo", - "MethodTitle":"Foo", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - }, - "Measurements":[ - { - "IterationMode":"Workload", - "IterationStage":"Result", - "LaunchIndex":1, - "IterationIndex":1, - "Operations":1, - "Nanoseconds":1 - } - ] - },{ - "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", - "Namespace":"BenchmarkDotNet.Tests.Mocks", - "Type":"MockBenchmarkClass", - "Method":"Bar", - "MethodTitle":"Bar", - "Parameters":"", - "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", - "HardwareIntrinsics":"", - "Statistics":{ - "OriginalValues":[ - 1 - ], - "N":1, - "Min":1, - "LowerFence":1, - "Q1":1, - "Median":1, - "Mean":1, - "Q3":1, - "UpperFence":1, - "Max":1, - "InterquartileRange":0, - "LowerOutliers":[ - - ], - "UpperOutliers":[ - - ], - "AllOutliers":[ - - ], - "StandardError":0, - "Variance":0, - "StandardDeviation":0, - "Skewness":"", - "Kurtosis":"", - "ConfidenceInterval":{ - "N":1, - "Mean":1, - "StandardError":0, - "Level":12, - "Margin":"", - "Lower":"", - "Upper":"" - }, - "Percentiles":{ - "P0":1, - "P25":1, - "P50":1, - "P67":1, - "P80":1, - "P85":1, - "P90":1, - "P95":1, - "P100":1 - } - }, - "Memory":{ - "Gen0Collections":0, - "Gen1Collections":0, - "Gen2Collections":0, - "TotalOperations":0, - "BytesAllocatedPerOperation":null - }, - "Measurements":[ - { - "IterationMode":"Workload", - "IterationStage":"Result", - "LaunchIndex":1, - "IterationIndex":1, - "Operations":1, - "Nanoseconds":1 - } - ] - } + { + "DisplayInfo":"MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Foo", + "MethodTitle":"Foo", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Foo", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + }, + "Measurements":[ + { + "IterationMode":"Workload", + "IterationStage":"Result", + "LaunchIndex":1, + "IterationIndex":1, + "Operations":1, + "Nanoseconds":1 + } + ] + },{ + "DisplayInfo":"MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15)", + "Namespace":"BenchmarkDotNet.Tests.Mocks", + "Type":"MockBenchmarkClass", + "Method":"Bar", + "MethodTitle":"Bar", + "Parameters":"", + "FullName":"BenchmarkDotNet.Tests.Mocks.MockFactory+MockBenchmarkClass.Bar", + "HardwareIntrinsics":"", + "Statistics":{ + "OriginalValues":[ + 1 + ], + "N":1, + "Min":1, + "LowerFence":1, + "Q1":1, + "Median":1, + "Mean":1, + "Q3":1, + "UpperFence":1, + "Max":1, + "InterquartileRange":0, + "LowerOutliers":[ + + ], + "UpperOutliers":[ + + ], + "AllOutliers":[ + + ], + "StandardError":0, + "Variance":0, + "StandardDeviation":0, + "Skewness":"", + "Kurtosis":"", + "ConfidenceInterval":{ + "N":1, + "Mean":1, + "StandardError":0, + "Level":12, + "Margin":"", + "Lower":"", + "Upper":"" + }, + "Percentiles":{ + "P0":1, + "P25":1, + "P50":1, + "P67":1, + "P80":1, + "P85":1, + "P90":1, + "P95":1, + "P100":1 + } + }, + "Memory":{ + "Gen0Collections":0, + "Gen1Collections":0, + "Gen2Collections":0, + "TotalOperations":0, + "BytesAllocatedPerOperation":null + }, + "Measurements":[ + { + "IterationMode":"Workload", + "IterationStage":"Result", + "LaunchIndex":1, + "IterationIndex":1, + "Operations":1, + "Nanoseconds":1 + } + ] + } ] } ############################################ @@ -410,10 +410,10 @@ Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 - Method | Mean | Error | StdDev | P67 | + Method | Mean | Error | StdDev | P67 | ------- |---------:|------:|---------:|---------:| - Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | - Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-atlassian ############################################ @@ -429,9 +429,9 @@ Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 {noformat} -||Method || Mean ||Error || StdDev || P67 || -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +||Method || Mean ||Error || StdDev || P67 || +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-console ############################################ @@ -445,10 +445,10 @@ Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 -| Method | Mean | Error | StdDev | P67 | +| Method | Mean | Error | StdDev | P67 | |------- |---------:|------:|---------:|---------:| -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-github ############################################ @@ -464,27 +464,27 @@ Job=LongRun IterationCount=100 LaunchCount=3 WarmupCount=15 ``` -| Method | Mean | Error | StdDev | P67 | +| Method | Mean | Error | StdDev | P67 | |------- |---------:|------:|---------:|---------:| -| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | -| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | +| Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ MarkdownExporter-stackoverflow ############################################ - BenchmarkDotNet v0.10.x-mock, Microsoft Windows NT 10.0.x.mock (Hyper-V) - MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores - Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC - [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION - LongRun : extra output line + BenchmarkDotNet v0.10.x-mock, Microsoft Windows NT 10.0.x.mock (Hyper-V) + MockIntel Core i7-6700HQ CPU 2.60GHz (Max: 3.10GHz), 1 CPU, 8 logical and 4 physical cores + Frequency: 2531248 Hz, Resolution: 395.0620 ns, Timer: TSC + [Host] : Clr 4.0.x.mock, 64mock RyuJIT-v4.6.x.mock CONFIGURATION + LongRun : extra output line - Job=LongRun IterationCount=100 LaunchCount=3 - WarmupCount=15 + Job=LongRun IterationCount=100 LaunchCount=3 + WarmupCount=15 - Method | Mean | Error | StdDev | P67 | - ------- |---------:|------:|---------:|---------:| - Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | - Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Method | Mean | Error | StdDev | P67 | + ------- |---------:|------:|---------:|---------:| + Foo | 1.000 ns | NA | 0.000 ns | 1.000 ns | + Bar | 1.000 ns | NA | 0.000 ns | 1.000 ns | ############################################ PlainExporter ############################################ @@ -521,132 +521,132 @@ XmlExporter-brief MockSummary - BenchmarkDotNet - 0.10.x-mock - Microsoft Windows NT 10.0.x.mock - MockIntel Core i7-6700HQ CPU 2.60GHz - 1 - 4 - 8 - Clr 4.0.x.mock - 64mock - False - True - CONFIGURATION - - 2531248 - - Tsc + BenchmarkDotNet + 0.10.x-mock + Microsoft Windows NT 10.0.x.mock + MockIntel Core i7-6700HQ CPU 2.60GHz + 1 + 4 + 8 + Clr 4.0.x.mock + 64mock + False + True + CONFIGURATION + + 2531248 + + Tsc - - MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Foo - Foo - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Bar - Bar - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - + + MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Foo + Foo + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Bar + Bar + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + ############################################ @@ -660,152 +660,152 @@ XmlExporter-full MockSummary - BenchmarkDotNet - 0.10.x-mock - Microsoft Windows NT 10.0.x.mock - MockIntel Core i7-6700HQ CPU 2.60GHz - 1 - 4 - 8 - Clr 4.0.x.mock - 64mock - False - True - CONFIGURATION - - 2531248 - - Tsc + BenchmarkDotNet + 0.10.x-mock + Microsoft Windows NT 10.0.x.mock + MockIntel Core i7-6700HQ CPU 2.60GHz + 1 + 4 + 8 + Clr 4.0.x.mock + 64mock + False + True + CONFIGURATION + + 2531248 + + Tsc - - MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Foo - Foo - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - Workload - Result - 1 - 1 - 1 - 1 - - - - - MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) - BenchmarkDotNet.Tests.Mocks - MockBenchmarkClass - Bar - Bar - - - 1 - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - 0 - NaN - NaN - - 1 - 1 - 0 - L999 - NaN - NaN - NaN - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - - 0 - 0 - 0 - 0 - - - - - Workload - Result - 1 - 1 - 1 - 1 - - - + + MockBenchmarkClass.Foo: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Foo + Foo + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + Workload + Result + 1 + 1 + 1 + 1 + + + + + MockBenchmarkClass.Bar: LongRun(IterationCount=100, LaunchCount=3, WarmupCount=15) + BenchmarkDotNet.Tests.Mocks + MockBenchmarkClass + Bar + Bar + + + 1 + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + 0 + NaN + NaN + + 1 + 1 + 0 + L999 + NaN + NaN + NaN + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + + + + 0 + 0 + 0 + 0 + + + + + Workload + Result + 1 + 1 + 1 + 1 + + + ############################################ From 1ea9abfcd50ddfbb6104296434f036cedb3e60ce Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 17:17:42 +0200 Subject: [PATCH 19/21] Cosmetic changes --- .../Exporters/MarkdownExporterVerifyTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index fb56180cf1..237d73025f 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -14,13 +14,14 @@ using JetBrains.Annotations; using VerifyXunit; using Xunit; + using static BenchmarkDotNet.Tests.Exporters.MarkdownExporterVerifyTests.BaselinesBenchmarks; namespace BenchmarkDotNet.Tests.Exporters { [Collection("VerifyTests")] [UsesVerify] - public class MarkdownExporterVerifyTests : IDisposable + public class MarkdownExporterVerifyTests : IDisposable { private readonly CultureInfo initCulture; @@ -216,12 +217,12 @@ public class MethodBaseline_MethodsParamsJobs [Benchmark(Baseline = true)] public void Base() { } [Benchmark] public void Foo() { } [Benchmark] public void Bar() { } - } - + } + /* JobBaseline */ [RankColumn, LogicalGroupColumn, BaselineColumn] - [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] + [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] public class JobBaseline_MethodsJobs { [Benchmark] public void Base() { } From ece8bf4338339e2dde62788706824906c5527bc4 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 17:45:53 +0200 Subject: [PATCH 20/21] Cosmetic changes --- .../Exporters/MarkdownExporterVerifyTests.cs | 72 +++++++++---------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index 237d73025f..e0e4d34572 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -13,16 +13,14 @@ using BenchmarkDotNet.Validators; using JetBrains.Annotations; using VerifyXunit; -using Xunit; - -using static BenchmarkDotNet.Tests.Exporters.MarkdownExporterVerifyTests.BaselinesBenchmarks; - +using Xunit; + namespace BenchmarkDotNet.Tests.Exporters { [Collection("VerifyTests")] [UsesVerify] - public class MarkdownExporterVerifyTests : IDisposable - { + public class MarkdownExporterVerifyTests : IDisposable + { private readonly CultureInfo initCulture; public MarkdownExporterVerifyTests() => initCulture = Thread.CurrentThread.CurrentCulture; @@ -34,31 +32,31 @@ public static TheoryData GetGroupBenchmarkTypes() foreach (var type in typeof(BaselinesBenchmarks).GetNestedTypes()) data.Add(type); return data; - } - - [Theory] - [MemberData(nameof(GetGroupBenchmarkTypes))] - public Task GroupExporterTest(Type benchmarkType) - { - Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; - - var logger = new AccumulationLogger(); - logger.WriteLine("=== " + benchmarkType.Name + " ==="); - - var exporter = MarkdownExporter.Mock; - var summary = MockFactory.CreateSummary(benchmarkType); - exporter.ExportToLog(summary, logger); - - var validator = BaselineValidator.FailOnError; - var errors = validator.Validate(new ValidationParameters(summary.BenchmarksCases, summary.BenchmarksCases.First().Config)).ToList(); - logger.WriteLine(); - logger.WriteLine("Errors: " + errors.Count); - foreach (var error in errors) - logger.WriteLineError("* " + error.Message); - - var settings = VerifySettingsFactory.Create(); - settings.UseTextForParameters(benchmarkType.Name); - return Verifier.Verify(logger.GetLog(), settings); + } + + [Theory] + [MemberData(nameof(GetGroupBenchmarkTypes))] + public Task GroupExporterTest(Type benchmarkType) + { + Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; + + var logger = new AccumulationLogger(); + logger.WriteLine("=== " + benchmarkType.Name + " ==="); + + var exporter = MarkdownExporter.Mock; + var summary = MockFactory.CreateSummary(benchmarkType); + exporter.ExportToLog(summary, logger); + + var validator = BaselineValidator.FailOnError; + var errors = validator.Validate(new ValidationParameters(summary.BenchmarksCases, summary.BenchmarksCases.First().Config)).ToList(); + logger.WriteLine(); + logger.WriteLine("Errors: " + errors.Count); + foreach (var error in errors) + logger.WriteLineError("* " + error.Message); + + var settings = VerifySettingsFactory.Create(); + settings.UseTextForParameters(benchmarkType.Name); + return Verifier.Verify(logger.GetLog(), settings); } [Fact] @@ -217,13 +215,13 @@ public class MethodBaseline_MethodsParamsJobs [Benchmark(Baseline = true)] public void Base() { } [Benchmark] public void Foo() { } [Benchmark] public void Bar() { } - } - - /* JobBaseline */ - + } + + /* JobBaseline */ + [RankColumn, LogicalGroupColumn, BaselineColumn] - [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] - public class JobBaseline_MethodsJobs + [SimpleJob(id: "Job1", baseline: true), SimpleJob(id: "Job2")] + public class JobBaseline_MethodsJobs { [Benchmark] public void Base() { } [Benchmark] public void Foo() { } From 4a44743ef920e6a4f50eff971e06d1702e92b1d1 Mon Sep 17 00:00:00 2001 From: Nepp3r Date: Thu, 10 Aug 2023 17:49:31 +0200 Subject: [PATCH 21/21] Cosmetic changes --- .../Exporters/MarkdownExporterVerifyTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs index e0e4d34572..23a7daf465 100644 --- a/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs +++ b/tests/BenchmarkDotNet.Tests/Exporters/MarkdownExporterVerifyTests.cs @@ -15,6 +15,8 @@ using VerifyXunit; using Xunit; +using static BenchmarkDotNet.Tests.Exporters.MarkdownExporterVerifyTests.BaselinesBenchmarks; + namespace BenchmarkDotNet.Tests.Exporters { [Collection("VerifyTests")] @@ -62,7 +64,6 @@ public Task GroupExporterTest(Type benchmarkType) [Fact] public Task GroupExporterMultipleTypesTest() { - Type[] benchmarkTypes = new Type[] { typeof(JobBaseline_MethodsJobs_WithAttribute), typeof(JobBaseline_MethodsJobs) }; Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; var logger = new AccumulationLogger();