From f1f1dd61a52fce76f8505f5b10fd0d4434898843 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 15 Jul 2016 17:16:52 +0200 Subject: [PATCH 1/3] update to latest #BenchmarkDotNet version Former-commit-id: 6ca587c2d3f773d2f430030e2ca0d8d4bd7fe11b Former-commit-id: 01b7b1e4c8fb0146d5efa0d755d0d0f248df5eeb Former-commit-id: 20c535434e174f9adb525313989423a986df908e --- NuGet.config | 3 ++- tests/ImageProcessorCore.Benchmarks/Config.cs | 14 +++++++++++++ .../ImageProcessorCore.Benchmarks/Program.cs | 21 +------------------ .../Properties/AssemblyInfo.cs | 4 ++++ .../project.json | 10 +++------ 5 files changed, 24 insertions(+), 28 deletions(-) create mode 100644 tests/ImageProcessorCore.Benchmarks/Config.cs diff --git a/NuGet.config b/NuGet.config index 554c2f634..05430a8ee 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,6 +1,7 @@ - + + \ No newline at end of file diff --git a/tests/ImageProcessorCore.Benchmarks/Config.cs b/tests/ImageProcessorCore.Benchmarks/Config.cs new file mode 100644 index 000000000..10f377bb5 --- /dev/null +++ b/tests/ImageProcessorCore.Benchmarks/Config.cs @@ -0,0 +1,14 @@ +using BenchmarkDotNet.Configs; + +namespace ImageProcessorCore.Benchmarks +{ + public class Config : ManualConfig + { + public Config() + { + // uncomment if you want to use any of the diagnoser + //Add(new BenchmarkDotNet.Diagnostics.MemoryDiagnoser()); + //Add(new BenchmarkDotNet.Diagnostics.InliningDiagnoser()); + } + } +} \ No newline at end of file diff --git a/tests/ImageProcessorCore.Benchmarks/Program.cs b/tests/ImageProcessorCore.Benchmarks/Program.cs index 9e743dd02..ddbb4cd81 100644 --- a/tests/ImageProcessorCore.Benchmarks/Program.cs +++ b/tests/ImageProcessorCore.Benchmarks/Program.cs @@ -1,11 +1,5 @@ namespace ImageProcessorCore.Benchmarks { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - - using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running; public class Program @@ -18,20 +12,7 @@ /// public static void Main(string[] args) { - // Use reflection for a more maintainable way of creating the benchmark switcher, - Type[] benchmarks = typeof(Program).Assembly.GetTypes() - .Where(t => t.GetMethods(BindingFlags.Instance | BindingFlags.Public) - .Any(m => m.GetCustomAttributes(typeof(BenchmarkAttribute), false).Any())) - .OrderBy(t => t.Namespace) - .ThenBy(t => t.Name) - .ToArray(); - - // TODO: This throws an exception. - // List x = new List(args) { "diagnosers=MemoryDiagnoser,InliningDiagnoser" }; - BenchmarkSwitcher benchmarkSwitcher = new BenchmarkSwitcher(benchmarks); - - // benchmarkSwitcher.Run(x.ToArray()); - benchmarkSwitcher.Run(args); + new BenchmarkSwitcher(typeof(Program).Assembly).Run(args); } } } diff --git a/tests/ImageProcessorCore.Benchmarks/Properties/AssemblyInfo.cs b/tests/ImageProcessorCore.Benchmarks/Properties/AssemblyInfo.cs index 08636c390..695e5b740 100644 --- a/tests/ImageProcessorCore.Benchmarks/Properties/AssemblyInfo.cs +++ b/tests/ImageProcessorCore.Benchmarks/Properties/AssemblyInfo.cs @@ -1,6 +1,8 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using BenchmarkDotNet.Attributes; +using ImageProcessorCore.Benchmarks; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -21,3 +23,5 @@ using System.Runtime.InteropServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("299d8e18-102c-42de-adbf-79098ee706a8")] + +[assembly: Config(typeof(Config))] \ No newline at end of file diff --git a/tests/ImageProcessorCore.Benchmarks/project.json b/tests/ImageProcessorCore.Benchmarks/project.json index ebeb7dc64..6d70e44cb 100644 --- a/tests/ImageProcessorCore.Benchmarks/project.json +++ b/tests/ImageProcessorCore.Benchmarks/project.json @@ -13,8 +13,8 @@ "emitEntryPoint": true }, "dependencies": { - "BenchmarkDotNet": "0.9.7", - "BenchmarkDotNet.Diagnostics.Windows": "0.9.7", + "BenchmarkDotNet": "0.9.8-develop", + "BenchmarkDotNet.Diagnostics.Windows": "0.9.8-develop", "ImageProcessorCore": "1.0.0-*" }, "commands": { @@ -24,12 +24,8 @@ "net451": { "dependencies": { }, - "imports": [ - "dnx451" - ], "frameworkAssemblies": { - "System.Drawing": "", - "System.Runtime": "" + "System.Drawing": "" } } } From 23f87dbd201a6b46fb5066d041feb76a5a327624 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Mon, 18 Jul 2016 02:43:47 +0200 Subject: [PATCH 2/3] use the right nuget package that contains the fix + namespace fix Former-commit-id: 3203aa870f85a72005d09c814151abdb760fca8c Former-commit-id: 38a7036b1a7aecd46879ac2d64b1cd099a6e34db Former-commit-id: 23721bcd71dc78358aa04c10525a8f1af2a6af65 --- tests/ImageProcessorCore.Benchmarks/Config.cs | 4 ++-- tests/ImageProcessorCore.Benchmarks/project.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/ImageProcessorCore.Benchmarks/Config.cs b/tests/ImageProcessorCore.Benchmarks/Config.cs index 10f377bb5..1b8853300 100644 --- a/tests/ImageProcessorCore.Benchmarks/Config.cs +++ b/tests/ImageProcessorCore.Benchmarks/Config.cs @@ -7,8 +7,8 @@ namespace ImageProcessorCore.Benchmarks public Config() { // uncomment if you want to use any of the diagnoser - //Add(new BenchmarkDotNet.Diagnostics.MemoryDiagnoser()); - //Add(new BenchmarkDotNet.Diagnostics.InliningDiagnoser()); + //Add(new BenchmarkDotNet.Diagnostics.Windows.MemoryDiagnoser()); + //Add(new BenchmarkDotNet.Diagnostics.Windows.InliningDiagnoser()); } } } \ No newline at end of file diff --git a/tests/ImageProcessorCore.Benchmarks/project.json b/tests/ImageProcessorCore.Benchmarks/project.json index 6d70e44cb..6aabff3df 100644 --- a/tests/ImageProcessorCore.Benchmarks/project.json +++ b/tests/ImageProcessorCore.Benchmarks/project.json @@ -13,8 +13,7 @@ "emitEntryPoint": true }, "dependencies": { - "BenchmarkDotNet": "0.9.8-develop", - "BenchmarkDotNet.Diagnostics.Windows": "0.9.8-develop", + "BenchmarkDotNet.Diagnostics.Windows": "0.9.8.78", "ImageProcessorCore": "1.0.0-*" }, "commands": { From 92d86df8ba650dbd017c27a7893b59a7b5acc992 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 18 Jul 2016 14:41:56 +1000 Subject: [PATCH 3/3] Enable analyser [skip ci] Former-commit-id: 9bb39e691cd827ac0970beeb5c82cf78ff1654c0 Former-commit-id: cba638c99eae3467387661ba330c6a6593f93f84 Former-commit-id: 52aaec2abd2aeaaf822cb90c604b982bd43df07b --- tests/ImageProcessorCore.Benchmarks/Config.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ImageProcessorCore.Benchmarks/Config.cs b/tests/ImageProcessorCore.Benchmarks/Config.cs index 1b8853300..e2eb1f0ff 100644 --- a/tests/ImageProcessorCore.Benchmarks/Config.cs +++ b/tests/ImageProcessorCore.Benchmarks/Config.cs @@ -6,9 +6,9 @@ namespace ImageProcessorCore.Benchmarks { public Config() { - // uncomment if you want to use any of the diagnoser - //Add(new BenchmarkDotNet.Diagnostics.Windows.MemoryDiagnoser()); - //Add(new BenchmarkDotNet.Diagnostics.Windows.InliningDiagnoser()); + // Uncomment if you want to use any of the diagnoser + this.Add(new BenchmarkDotNet.Diagnostics.Windows.MemoryDiagnoser()); + this.Add(new BenchmarkDotNet.Diagnostics.Windows.InliningDiagnoser()); } } } \ No newline at end of file