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..e2eb1f0ff --- /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 + this.Add(new BenchmarkDotNet.Diagnostics.Windows.MemoryDiagnoser()); + this.Add(new BenchmarkDotNet.Diagnostics.Windows.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..6aabff3df 100644 --- a/tests/ImageProcessorCore.Benchmarks/project.json +++ b/tests/ImageProcessorCore.Benchmarks/project.json @@ -13,8 +13,7 @@ "emitEntryPoint": true }, "dependencies": { - "BenchmarkDotNet": "0.9.7", - "BenchmarkDotNet.Diagnostics.Windows": "0.9.7", + "BenchmarkDotNet.Diagnostics.Windows": "0.9.8.78", "ImageProcessorCore": "1.0.0-*" }, "commands": { @@ -24,12 +23,8 @@ "net451": { "dependencies": { }, - "imports": [ - "dnx451" - ], "frameworkAssemblies": { - "System.Drawing": "", - "System.Runtime": "" + "System.Drawing": "" } } }