From be42aed3696ec96590623dbad4fe736c6179740a Mon Sep 17 00:00:00 2001 From: Jeff Treuting Date: Wed, 5 Jun 2013 19:57:48 -0700 Subject: [PATCH 1/3] POC for loading assembly and running tests on a couple methods of the users choosing --- .../Properties/AssemblyInfo.cs | 36 ++++++++ .../SharpBenchmark.ExampleDll.csproj | 53 ++++++++++++ SharpBenchmark.ExampleDll/Test1.cs | 30 +++++++ SharpBenchmark.Samples/App.config | 3 + SharpBenchmark.Samples/DelegateBuilder.cs | 67 +++++++++++++++ SharpBenchmark.Samples/Program.cs | 86 ++++++++++++++++++- .../SharpBenchmark.Samples.csproj | 2 + SharpBenchmark.sln | 6 ++ 8 files changed, 282 insertions(+), 1 deletion(-) create mode 100644 SharpBenchmark.ExampleDll/Properties/AssemblyInfo.cs create mode 100644 SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj create mode 100644 SharpBenchmark.ExampleDll/Test1.cs create mode 100644 SharpBenchmark.Samples/DelegateBuilder.cs diff --git a/SharpBenchmark.ExampleDll/Properties/AssemblyInfo.cs b/SharpBenchmark.ExampleDll/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a416839 --- /dev/null +++ b/SharpBenchmark.ExampleDll/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SharpBenchmark.ExampleDll")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SharpBenchmark.ExampleDll")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6b46f92e-0bdc-4208-b4a0-7ad34ad2d567")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj b/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj new file mode 100644 index 0000000..3fee0c2 --- /dev/null +++ b/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9} + Library + Properties + SharpBenchmark.ExampleDll + SharpBenchmark.ExampleDll + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SharpBenchmark.ExampleDll/Test1.cs b/SharpBenchmark.ExampleDll/Test1.cs new file mode 100644 index 0000000..0ecfc56 --- /dev/null +++ b/SharpBenchmark.ExampleDll/Test1.cs @@ -0,0 +1,30 @@ +using System.Threading; + +namespace SharpBenchmark.ExampleDll +{ + public class Test1 + { + public void Algorithm1() + { + Thread.Sleep(125); + } + + public void Algorithm2() + { + Thread.Sleep(235); + } + } + + public class Test2 + { + public void Algorithm1(int delay) + { + Thread.Sleep(delay); + } + + public void Algorithm2(int delay) + { + Thread.Sleep(delay); + } + } +} diff --git a/SharpBenchmark.Samples/App.config b/SharpBenchmark.Samples/App.config index 8e15646..6f59ab1 100644 --- a/SharpBenchmark.Samples/App.config +++ b/SharpBenchmark.Samples/App.config @@ -3,4 +3,7 @@ + + + \ No newline at end of file diff --git a/SharpBenchmark.Samples/DelegateBuilder.cs b/SharpBenchmark.Samples/DelegateBuilder.cs new file mode 100644 index 0000000..26c0079 --- /dev/null +++ b/SharpBenchmark.Samples/DelegateBuilder.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; + +namespace SharpBenchmark.Samples +{ + public class DelegateBuilder + { + public static T BuildDelegate(MethodInfo method, params object[] missingParamValues) + { + var queueMissingParams = new Queue(missingParamValues); + + var dgtMi = typeof(T).GetMethod("Invoke"); + var dgtRet = dgtMi.ReturnType; + var dgtParams = dgtMi.GetParameters(); + + var paramsOfDelegate = dgtParams + .Select(tp => Expression.Parameter(tp.ParameterType, tp.Name)) + .ToArray(); + + var methodParams = method.GetParameters(); + + if (method.IsStatic) + { + var paramsToPass = methodParams + .Select((p, i) => CreateParam(paramsOfDelegate, i, p, queueMissingParams)) + .ToArray(); + + var expr = Expression.Lambda( + Expression.Call(method, paramsToPass), + paramsOfDelegate); + + return expr.Compile(); + } + else + { + var paramThis = Expression.Convert(paramsOfDelegate[0], method.DeclaringType); + + var paramsToPass = methodParams + .Select((p, i) => CreateParam(paramsOfDelegate, i + 1, p, queueMissingParams)) + .ToArray(); + + var expr = Expression.Lambda( + Expression.Call(paramThis, method, paramsToPass), + paramsOfDelegate); + + return expr.Compile(); + } + } + + private static Expression CreateParam(ParameterExpression[] paramsOfDelegate, int i, ParameterInfo callParamType, Queue queueMissingParams) + { + if (i < paramsOfDelegate.Length) + return Expression.Convert(paramsOfDelegate[i], callParamType.ParameterType); + + if (queueMissingParams.Count > 0) + return Expression.Constant(queueMissingParams.Dequeue()); + + if (callParamType.ParameterType.IsValueType) + return Expression.Constant(Activator.CreateInstance(callParamType.ParameterType)); + + return Expression.Constant(null); + } + } +} diff --git a/SharpBenchmark.Samples/Program.cs b/SharpBenchmark.Samples/Program.cs index 74468c1..d95354c 100644 --- a/SharpBenchmark.Samples/Program.cs +++ b/SharpBenchmark.Samples/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Configuration; using System.Linq; namespace SharpBenchmark.Samples @@ -9,14 +10,23 @@ static void Main(string[] args) { var allSamples = typeof(ISample).Assembly.GetTypes(); + + + while (true) { - Console.Write("Which sample would you like to run? (enter q to quit): "); + Console.Write("Which sample would you like to run? (enter q to quit, enter load to load a dll): "); var input = Console.ReadLine(); if (input == "q" || input == null) break; + if (input == "load") + { + LoadDll(); + continue; + } + var parts = input.Split(' '); var sampleNum = 0; if (!Int32.TryParse(parts[0], out sampleNum)) @@ -42,5 +52,79 @@ static void Main(string[] args) sample.Execute(tmp.ToArray()); } } + + static void LoadDll() + { + Console.WriteLine("Full Path to DLL (or blank to use testing DLL): "); + var path = Console.ReadLine(); + //Console.WriteLine("Full Path to DLL: "); + if (String.IsNullOrEmpty(path)) + path = @"C:\Projects\SharpBenchmark\SharpBenchmark.ExampleDll\bin\Debug\SharpBenchmark.ExampleDll.dll"; + + if (!String.IsNullOrEmpty(path)) + { + var dll = System.Reflection.Assembly.LoadFrom(path); + + var types = dll.GetTypes(); + + Console.WriteLine("Types in the DLL"); + Console.WriteLine("-------------------------"); + + var i = 1; + foreach (var type in types) + { + Console.WriteLine("{0}) {1} ", i, type.FullName); + + i++; + } + + Console.WriteLine(); + Console.WriteLine("Enter the number of the type you'd like to use: "); + var input = Console.ReadLine(); + + var typeNum = Int32.Parse(input); + var selectedType = types[typeNum - 1]; + + Console.WriteLine(); + Console.WriteLine("Methods in this type"); + Console.WriteLine("-------------------------"); + + // get all public methods + i = 1; + var methods = selectedType.GetMethods(); + foreach (var method in methods) + { + Console.Write("{0}) {1}(", i, method.Name); + + foreach (var pi in method.GetParameters()) + { + Console.Write("{0} {1}, ", pi.ParameterType, pi.Name); + } + + Console.WriteLine(")"); + i++; + } + + Console.WriteLine(); + Console.WriteLine("Enter the number(s) of the method you'd like to use: "); + input = Console.ReadLine(); + + var benchmarker = new Benchmarker(); + + foreach (var methodNum in input.Split(',').Select(x => Int32.Parse(x.Trim()))) + { + var selectedMethod = methods[methodNum - 1]; + + // create an action with this method + // TODO: make this work with methods that have parameters, right now it won't + var newType = Activator.CreateInstance(selectedType); + var del = (Action)Delegate.CreateDelegate(typeof(Action), newType, selectedMethod); + + benchmarker.AddTest(selectedMethod.Name, del); + } + + benchmarker.RunTests(20); + } + } } } diff --git a/SharpBenchmark.Samples/SharpBenchmark.Samples.csproj b/SharpBenchmark.Samples/SharpBenchmark.Samples.csproj index d01e281..abe6119 100644 --- a/SharpBenchmark.Samples/SharpBenchmark.Samples.csproj +++ b/SharpBenchmark.Samples/SharpBenchmark.Samples.csproj @@ -33,6 +33,7 @@ + @@ -42,6 +43,7 @@ + diff --git a/SharpBenchmark.sln b/SharpBenchmark.sln index 94e707c..81a0219 100644 --- a/SharpBenchmark.sln +++ b/SharpBenchmark.sln @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpBenchmark", "SharpBenc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpBenchmark.Samples", "SharpBenchmark.Samples\SharpBenchmark.Samples.csproj", "{78A8F10A-B3CA-4C45-8EB7-D5AEE0B7E73F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpBenchmark.ExampleDll", "SharpBenchmark.ExampleDll\SharpBenchmark.ExampleDll.csproj", "{0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -19,6 +21,10 @@ Global {78A8F10A-B3CA-4C45-8EB7-D5AEE0B7E73F}.Debug|Any CPU.Build.0 = Debug|Any CPU {78A8F10A-B3CA-4C45-8EB7-D5AEE0B7E73F}.Release|Any CPU.ActiveCfg = Release|Any CPU {78A8F10A-B3CA-4C45-8EB7-D5AEE0B7E73F}.Release|Any CPU.Build.0 = Release|Any CPU + {0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0ACEB135-2314-4A6F-A9B6-3D2EF5B013B9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 6981dffe0403cb7f1cc09de63f0acf66dda35125 Mon Sep 17 00:00:00 2001 From: Jeff Treuting Date: Mon, 10 Jun 2013 14:04:55 -0700 Subject: [PATCH 2/3] Created console and WPF GUI app Basically you can choose a DLL and methods from it, and then provide values for the parameters and run it. Both are really proof of concepts at this point and I'm sure have many many bugs. There is no error checking/validation really at this point. And it is ugly, oh very ugly. --- SharpBenchmark.AssemblyHelper/ActionHelper.cs | 47 + .../Properties/AssemblyInfo.cs | 36 + .../SharpBenchmark.AssemblyHelper.csproj | 53 + .../ConstrcutorNeedsParams.cs | 18 + .../SharpBenchmark.ExampleDll.csproj | 4 + SharpBenchmark.ExampleDll/Test1.cs | 12 +- SharpBenchmark.ExampleDll/Test2.cs | 22 + SharpBenchmark.ExampleDll/Test3.cs | 28 + SharpBenchmark.ExampleDll/TestStatic.cs | 12 + SharpBenchmark.Samples/Program.cs | 116 +- .../SharpBenchmark.Samples.csproj | 4 + SharpBenchmark.Wpf/App.config | 34 + SharpBenchmark.Wpf/App.xaml | 14 + SharpBenchmark.Wpf/App.xaml.cs | 17 + SharpBenchmark.Wpf/AppBootstrapper.cs | 40 + .../Caliburn/Micro/Logging/DebugLogger.cs | 90 + SharpBenchmark.Wpf/IShell.cs | 3 + .../Models/AssemblyExplorerItem.cs | 98 + SharpBenchmark.Wpf/Models/AssemblyFilePath.cs | 10 + SharpBenchmark.Wpf/Properties/AssemblyInfo.cs | 55 + .../Properties/Resources.Designer.cs | 71 + SharpBenchmark.Wpf/Properties/Resources.resx | 117 + .../Properties/Settings.Designer.cs | 30 + .../Properties/Settings.settings | 7 + SharpBenchmark.Wpf/Repositories.cs | 12 + SharpBenchmark.Wpf/ResultsView.xaml | 12 + SharpBenchmark.Wpf/ResultsViewModel.cs | 12 + SharpBenchmark.Wpf/SharpBenchmark.Wpf.csproj | 149 + SharpBenchmark.Wpf/ShellView.xaml | 71 + SharpBenchmark.Wpf/ShellViewModel.cs | 177 + .../ViewModels/ParameterInputControl.cs | 39 + SharpBenchmark.Wpf/packages.config | 8 + .../SharpRepository.Repository.dll | Bin 0 -> 260608 bytes .../SharpRepository.XmlRepository.dll | Bin 0 -> 11264 bytes SharpBenchmark.sln | 12 + .../Caliburn.Micro.1.5.1.nupkg | Bin 0 -> 1281949 bytes .../Caliburn.Micro.1.5.1.nuspec | 28 + .../lib/net40/Caliburn.Micro.dll | Bin 0 -> 110592 bytes .../lib/net40/Caliburn.Micro.xml | 2995 ++++ .../net40/System.Windows.Interactivity.dll | Bin 0 -> 39936 bytes .../net40/System.Windows.Interactivity.xml | 1072 ++ .../lib/net45/Caliburn.Micro.XML | 3011 ++++ .../lib/net45/Caliburn.Micro.dll | Bin 0 -> 111104 bytes .../net45/System.Windows.Interactivity.dll | Bin 0 -> 55904 bytes .../net45/System.Windows.Interactivity.xml | 1072 ++ .../lib/sl4/Caliburn.Micro.dll | Bin 0 -> 106496 bytes .../lib/sl4/Caliburn.Micro.xml | 2874 +++ .../lib/sl4/System.Windows.Interactivity.dll | Bin 0 -> 37376 bytes .../lib/sl4/System.Windows.Interactivity.xml | 1025 ++ .../lib/sl5/Caliburn.Micro.dll | Bin 0 -> 107520 bytes .../lib/sl5/Caliburn.Micro.xml | 2989 ++++ .../lib/sl5/System.Windows.Interactivity.dll | Bin 0 -> 53856 bytes .../lib/sl5/System.Windows.Interactivity.xml | 1025 ++ .../lib/win8/Caliburn.Micro.Extensions.dll | Bin 0 -> 22528 bytes .../lib/win8/Caliburn.Micro.Extensions.pri | Bin 0 -> 1232 bytes .../lib/win8/Caliburn.Micro.Extensions.xml | 437 + .../lib/win8/Caliburn.Micro.dll | Bin 0 -> 117248 bytes .../lib/win8/Caliburn.Micro.pri | Bin 0 -> 1184 bytes .../lib/win8/Caliburn.Micro.xml | 3145 ++++ .../lib/wp71/Caliburn.Micro.Extensions.dll | Bin 0 -> 38912 bytes .../lib/wp71/Caliburn.Micro.Extensions.xml | 936 + .../lib/wp71/Caliburn.Micro.dll | Bin 0 -> 125952 bytes .../lib/wp71/Caliburn.Micro.xml | 3303 ++++ .../lib/wp71/System.Windows.Interactivity.dll | Bin 0 -> 37888 bytes .../lib/wp71/System.Windows.Interactivity.xml | 1025 ++ .../lib/wp8/Caliburn.Micro.Extensions.dll | Bin 0 -> 38912 bytes .../lib/wp8/Caliburn.Micro.Extensions.xml | 936 + .../lib/wp8/Caliburn.Micro.dll | Bin 0 -> 126464 bytes .../lib/wp8/Caliburn.Micro.xml | 3409 ++++ .../lib/wp8/System.Windows.Interactivity.dll | Bin 0 -> 53872 bytes .../lib/wp8/System.Windows.Interactivity.xml | 1025 ++ .../Caliburn.Micro.Logging.1.5.0.0.nupkg | Bin 0 -> 15729 bytes .../Caliburn.Micro.Logging.1.5.0.0.nuspec | 23 + .../Caliburn/Micro/Logging/DebugLogger.cs | 90 + .../lib/net40/Caliburn.Micro.Logging.dll | Bin 0 -> 6656 bytes .../lib/sl4/Caliburn.Micro.Logging.dll | Bin 0 -> 5632 bytes .../lib/sl5/Caliburn.Micro.Logging.dll | Bin 0 -> 5632 bytes .../lib/wp71/Caliburn.Micro.Logging.dll | Bin 0 -> 6144 bytes .../lib/wp8/Caliburn.Micro.Logging.dll | Bin 0 -> 5632 bytes .../Caliburn.Micro.Logging.NLog.1.5.0.0.nupkg | Bin 0 -> 14385 bytes ...Caliburn.Micro.Logging.NLog.1.5.0.0.nuspec | 25 + .../lib/net40/Caliburn.Micro.Logging.NLog.dll | Bin 0 -> 5632 bytes .../lib/sl4/Caliburn.Micro.Logging.NLog.dll | Bin 0 -> 5632 bytes .../lib/sl5/Caliburn.Micro.Logging.NLog.dll | Bin 0 -> 5632 bytes .../lib/wp71/Caliburn.Micro.Logging.NLog.dll | Bin 0 -> 5632 bytes .../lib/wp8/Caliburn.Micro.Logging.NLog.dll | Bin 0 -> 5632 bytes .../Caliburn.Micro.Start.1.5.1.nupkg | Bin 0 -> 9867 bytes .../Caliburn.Micro.Start.1.5.1.nuspec | 27 + .../content/net40/AppBootstrapper.cs.pp | 56 + .../content/net40/IShell.cs.pp | 3 + .../content/net40/ShellView.xaml.pp | 12 + .../content/net40/ShellViewModel.cs.pp | 6 + .../content/sl4/AppBootstrapper.cs.pp | 56 + .../content/sl4/IShell.cs.pp | 3 + .../content/sl4/ShellView.xaml.pp | 12 + .../content/sl4/ShellViewModel.cs.pp | 6 + .../content/sl5/AppBootstrapper.cs.pp | 56 + .../content/sl5/IShell.cs.pp | 3 + .../content/sl5/ShellView.xaml.pp | 12 + .../content/sl5/ShellViewModel.cs.pp | 6 + .../content/wp71/AppBootstrapper.cs.pp | 76 + .../content/wp71/MainPageViewModel.cs.pp | 3 + .../tools/install.ps1 | 3 + packages/NLog.2.0.1.2/NLog.2.0.1.2.nupkg | Bin 0 -> 1660602 bytes packages/NLog.2.0.1.2/NLog.2.0.1.2.nuspec | 19 + packages/NLog.2.0.1.2/lib/net20/NLog.dll | Bin 0 -> 387584 bytes packages/NLog.2.0.1.2/lib/net20/NLog.xml | 14471 +++++++++++++++ packages/NLog.2.0.1.2/lib/net35/NLog.dll | Bin 0 -> 391680 bytes packages/NLog.2.0.1.2/lib/net35/NLog.xml | 14597 ++++++++++++++++ packages/NLog.2.0.1.2/lib/net40/NLog.dll | Bin 0 -> 398848 bytes packages/NLog.2.0.1.2/lib/net40/NLog.xml | 14547 +++++++++++++++ packages/NLog.2.0.1.2/lib/net45/NLog.dll | Bin 0 -> 393728 bytes packages/NLog.2.0.1.2/lib/net45/NLog.xml | 14547 +++++++++++++++ packages/NLog.2.0.1.2/lib/sl2/NLog.dll | Bin 0 -> 206848 bytes packages/NLog.2.0.1.2/lib/sl2/NLog.xml | 9181 ++++++++++ packages/NLog.2.0.1.2/lib/sl3-wp/NLog.dll | Bin 0 -> 203776 bytes packages/NLog.2.0.1.2/lib/sl3-wp/NLog.xml | 9052 ++++++++++ packages/NLog.2.0.1.2/lib/sl3/NLog.dll | Bin 0 -> 208384 bytes packages/NLog.2.0.1.2/lib/sl3/NLog.xml | 9215 ++++++++++ .../lib/sl4-windowsphone71/NLog.dll | Bin 0 -> 207872 bytes .../lib/sl4-windowsphone71/NLog.xml | 9179 ++++++++++ packages/NLog.2.0.1.2/lib/sl4/NLog.dll | Bin 0 -> 222208 bytes packages/NLog.2.0.1.2/lib/sl4/NLog.xml | 9616 ++++++++++ packages/NLog.2.0.1.2/lib/sl5/NLog.dll | Bin 0 -> 222208 bytes packages/NLog.2.0.1.2/lib/sl5/NLog.xml | 9616 ++++++++++ packages/repositories.config | 4 + 126 files changed, 146197 insertions(+), 62 deletions(-) create mode 100644 SharpBenchmark.AssemblyHelper/ActionHelper.cs create mode 100644 SharpBenchmark.AssemblyHelper/Properties/AssemblyInfo.cs create mode 100644 SharpBenchmark.AssemblyHelper/SharpBenchmark.AssemblyHelper.csproj create mode 100644 SharpBenchmark.ExampleDll/ConstrcutorNeedsParams.cs create mode 100644 SharpBenchmark.ExampleDll/Test2.cs create mode 100644 SharpBenchmark.ExampleDll/Test3.cs create mode 100644 SharpBenchmark.ExampleDll/TestStatic.cs create mode 100644 SharpBenchmark.Wpf/App.config create mode 100644 SharpBenchmark.Wpf/App.xaml create mode 100644 SharpBenchmark.Wpf/App.xaml.cs create mode 100644 SharpBenchmark.Wpf/AppBootstrapper.cs create mode 100644 SharpBenchmark.Wpf/Caliburn/Micro/Logging/DebugLogger.cs create mode 100644 SharpBenchmark.Wpf/IShell.cs create mode 100644 SharpBenchmark.Wpf/Models/AssemblyExplorerItem.cs create mode 100644 SharpBenchmark.Wpf/Models/AssemblyFilePath.cs create mode 100644 SharpBenchmark.Wpf/Properties/AssemblyInfo.cs create mode 100644 SharpBenchmark.Wpf/Properties/Resources.Designer.cs create mode 100644 SharpBenchmark.Wpf/Properties/Resources.resx create mode 100644 SharpBenchmark.Wpf/Properties/Settings.Designer.cs create mode 100644 SharpBenchmark.Wpf/Properties/Settings.settings create mode 100644 SharpBenchmark.Wpf/Repositories.cs create mode 100644 SharpBenchmark.Wpf/ResultsView.xaml create mode 100644 SharpBenchmark.Wpf/ResultsViewModel.cs create mode 100644 SharpBenchmark.Wpf/SharpBenchmark.Wpf.csproj create mode 100644 SharpBenchmark.Wpf/ShellView.xaml create mode 100644 SharpBenchmark.Wpf/ShellViewModel.cs create mode 100644 SharpBenchmark.Wpf/ViewModels/ParameterInputControl.cs create mode 100644 SharpBenchmark.Wpf/packages.config create mode 100644 SharpBenchmark.Wpf/temp-external-libs/SharpRepository.Repository.dll create mode 100644 SharpBenchmark.Wpf/temp-external-libs/SharpRepository.XmlRepository.dll create mode 100644 packages/Caliburn.Micro.1.5.1/Caliburn.Micro.1.5.1.nupkg create mode 100644 packages/Caliburn.Micro.1.5.1/Caliburn.Micro.1.5.1.nuspec create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net40/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net40/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net40/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net40/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net45/Caliburn.Micro.XML create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net45/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net45/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/net45/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl4/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl4/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl4/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl4/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl5/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl5/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl5/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/sl5/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.Extensions.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.Extensions.pri create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.Extensions.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.pri create mode 100644 packages/Caliburn.Micro.1.5.1/lib/win8/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/Caliburn.Micro.Extensions.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/Caliburn.Micro.Extensions.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp71/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/Caliburn.Micro.Extensions.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/Caliburn.Micro.Extensions.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/Caliburn.Micro.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/Caliburn.Micro.xml create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/System.Windows.Interactivity.dll create mode 100644 packages/Caliburn.Micro.1.5.1/lib/wp8/System.Windows.Interactivity.xml create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/Caliburn.Micro.Logging.1.5.0.0.nupkg create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/Caliburn.Micro.Logging.1.5.0.0.nuspec create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/content/Caliburn/Micro/Logging/DebugLogger.cs create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/lib/net40/Caliburn.Micro.Logging.dll create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/lib/sl4/Caliburn.Micro.Logging.dll create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/lib/sl5/Caliburn.Micro.Logging.dll create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/lib/wp71/Caliburn.Micro.Logging.dll create mode 100644 packages/Caliburn.Micro.Logging.1.5.0.0/lib/wp8/Caliburn.Micro.Logging.dll create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/Caliburn.Micro.Logging.NLog.1.5.0.0.nupkg create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/Caliburn.Micro.Logging.NLog.1.5.0.0.nuspec create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/lib/net40/Caliburn.Micro.Logging.NLog.dll create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/lib/sl4/Caliburn.Micro.Logging.NLog.dll create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/lib/sl5/Caliburn.Micro.Logging.NLog.dll create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/lib/wp71/Caliburn.Micro.Logging.NLog.dll create mode 100644 packages/Caliburn.Micro.Logging.NLog.1.5.0.0/lib/wp8/Caliburn.Micro.Logging.NLog.dll create mode 100644 packages/Caliburn.Micro.Start.1.5.1/Caliburn.Micro.Start.1.5.1.nupkg create mode 100644 packages/Caliburn.Micro.Start.1.5.1/Caliburn.Micro.Start.1.5.1.nuspec create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/net40/AppBootstrapper.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/net40/IShell.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/net40/ShellView.xaml.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/net40/ShellViewModel.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl4/AppBootstrapper.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl4/IShell.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl4/ShellView.xaml.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl4/ShellViewModel.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl5/AppBootstrapper.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl5/IShell.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl5/ShellView.xaml.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/sl5/ShellViewModel.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/wp71/AppBootstrapper.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/content/wp71/MainPageViewModel.cs.pp create mode 100644 packages/Caliburn.Micro.Start.1.5.1/tools/install.ps1 create mode 100644 packages/NLog.2.0.1.2/NLog.2.0.1.2.nupkg create mode 100644 packages/NLog.2.0.1.2/NLog.2.0.1.2.nuspec create mode 100644 packages/NLog.2.0.1.2/lib/net20/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/net20/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/net35/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/net35/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/net40/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/net40/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/net45/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/net45/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl2/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl2/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl3-wp/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl3-wp/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl3/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl3/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl4-windowsphone71/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl4-windowsphone71/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl4/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl4/NLog.xml create mode 100644 packages/NLog.2.0.1.2/lib/sl5/NLog.dll create mode 100644 packages/NLog.2.0.1.2/lib/sl5/NLog.xml create mode 100644 packages/repositories.config diff --git a/SharpBenchmark.AssemblyHelper/ActionHelper.cs b/SharpBenchmark.AssemblyHelper/ActionHelper.cs new file mode 100644 index 0000000..8586016 --- /dev/null +++ b/SharpBenchmark.AssemblyHelper/ActionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Reflection; + +namespace SharpBenchmark.AssemblyHelper +{ + public static class ActionHelper + { + public static Action BuildTestAction(Type instanceType, MethodInfo method, object[] parameterValues) + { + // this has parameters + var delegateMethod = CreateDelegateWithParameters(instanceType, method); + + // build the action to return + return () => delegateMethod.DynamicInvoke(parameterValues); + } + + private static Delegate CreateDelegateWithParameters(Type instanceType, MethodInfo method) + { + + object instance = null; + + if (!method.IsStatic) + { + //var constructors = instanceType.GetConstructors(); + + instance = Activator.CreateInstance(instanceType); + } + + var parameters = method.GetParameters(); + var args = new Expression[parameters.Length]; + var parameterExpressions = new List(); + for (var i = 0; i < args.Length; i++) + { + args[i] = Expression.Parameter(parameters[i].ParameterType, parameters[i].Name); + parameterExpressions.Add((ParameterExpression)args[i]); + } + + var callExpression = Expression.Call(instance == null ? null : Expression.Constant(instance), method, args); + + var lambdaExpression = Expression.Lambda(callExpression, parameterExpressions); + + return lambdaExpression.Compile(); + } + } +} diff --git a/SharpBenchmark.AssemblyHelper/Properties/AssemblyInfo.cs b/SharpBenchmark.AssemblyHelper/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c5d9e4f --- /dev/null +++ b/SharpBenchmark.AssemblyHelper/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SharpBenchmark.AssemblyHelper")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SharpBenchmark.AssemblyHelper")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("bdafd678-59fb-40d7-affa-80d41c09ff99")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SharpBenchmark.AssemblyHelper/SharpBenchmark.AssemblyHelper.csproj b/SharpBenchmark.AssemblyHelper/SharpBenchmark.AssemblyHelper.csproj new file mode 100644 index 0000000..f52c0cb --- /dev/null +++ b/SharpBenchmark.AssemblyHelper/SharpBenchmark.AssemblyHelper.csproj @@ -0,0 +1,53 @@ + + + + + Debug + AnyCPU + {F6E26086-C663-43BE-A893-E9B6C5F6894A} + Library + Properties + SharpBenchmark.AssemblyHelper + SharpBenchmark.AssemblyHelper + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SharpBenchmark.ExampleDll/ConstrcutorNeedsParams.cs b/SharpBenchmark.ExampleDll/ConstrcutorNeedsParams.cs new file mode 100644 index 0000000..3e6cd3f --- /dev/null +++ b/SharpBenchmark.ExampleDll/ConstrcutorNeedsParams.cs @@ -0,0 +1,18 @@ +using System.Threading; + +namespace SharpBenchmark.ExampleDll +{ + public class ConstrucutorNeedsParams + { + private readonly int _delay; + public ConstrucutorNeedsParams(int delay) + { + _delay = delay; + } + + public void Algorithm1() + { + Thread.Sleep(_delay); + } + } +} diff --git a/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj b/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj index 3fee0c2..a5597e1 100644 --- a/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj +++ b/SharpBenchmark.ExampleDll/SharpBenchmark.ExampleDll.csproj @@ -39,8 +39,12 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SharpBenchmark.Wpf/Properties/Settings.Designer.cs b/SharpBenchmark.Wpf/Properties/Settings.Designer.cs new file mode 100644 index 0000000..7fbc225 --- /dev/null +++ b/SharpBenchmark.Wpf/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18047 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SharpBenchmark.Wpf.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/SharpBenchmark.Wpf/Properties/Settings.settings b/SharpBenchmark.Wpf/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/SharpBenchmark.Wpf/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/SharpBenchmark.Wpf/Repositories.cs b/SharpBenchmark.Wpf/Repositories.cs new file mode 100644 index 0000000..199511d --- /dev/null +++ b/SharpBenchmark.Wpf/Repositories.cs @@ -0,0 +1,12 @@ +using System; +using SharpBenchmark.Wpf.Models; +using SharpRepository.Repository; + +namespace SharpBenchmark.Wpf +{ + public static class Repositories + { + public static IRepository AssemblyFileRepository = RepositoryFactory.GetInstance(); +// public static IRepository AssemblyFileRepository = RepositoryFactory.GetInstance(); + } +} diff --git a/SharpBenchmark.Wpf/ResultsView.xaml b/SharpBenchmark.Wpf/ResultsView.xaml new file mode 100644 index 0000000..0adfbff --- /dev/null +++ b/SharpBenchmark.Wpf/ResultsView.xaml @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/SharpBenchmark.Wpf/ResultsViewModel.cs b/SharpBenchmark.Wpf/ResultsViewModel.cs new file mode 100644 index 0000000..ab46468 --- /dev/null +++ b/SharpBenchmark.Wpf/ResultsViewModel.cs @@ -0,0 +1,12 @@ +namespace SharpBenchmark.Wpf +{ + public class ResultsViewModel + { + public ResultsViewModel(string results) + { + Display = results; + } + + public string Display { get; set; } + } +} diff --git a/SharpBenchmark.Wpf/SharpBenchmark.Wpf.csproj b/SharpBenchmark.Wpf/SharpBenchmark.Wpf.csproj new file mode 100644 index 0000000..9c7ebb5 --- /dev/null +++ b/SharpBenchmark.Wpf/SharpBenchmark.Wpf.csproj @@ -0,0 +1,149 @@ + + + + + Debug + AnyCPU + {23DD0E1F-D1D8-4E6B-930E-C92D78BA6754} + WinExe + Properties + SharpBenchmark.Wpf + SharpBenchmark.Wpf + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Caliburn.Micro.1.5.1\lib\net45\Caliburn.Micro.dll + + + ..\packages\Caliburn.Micro.Logging.1.5.0.0\lib\net40\Caliburn.Micro.Logging.dll + + + ..\packages\Caliburn.Micro.Logging.NLog.1.5.0.0\lib\net40\Caliburn.Micro.Logging.NLog.dll + + + ..\packages\NLog.2.0.1.2\lib\net45\NLog.dll + + + temp-external-libs\SharpRepository.Repository.dll + + + temp-external-libs\SharpRepository.XmlRepository.dll + + + + + + ..\packages\Caliburn.Micro.1.5.1\lib\net45\System.Windows.Interactivity.dll + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + + + + + + + + App.xaml + Code + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + {f6e26086-c663-43be-a893-e9b6c5f6894a} + SharpBenchmark.AssemblyHelper + + + {df0fc087-3d83-4dd4-b8f9-f6688f5fc70a} + SharpBenchmark + + + + + \ No newline at end of file diff --git a/SharpBenchmark.Wpf/ShellView.xaml b/SharpBenchmark.Wpf/ShellView.xaml new file mode 100644 index 0000000..a7f2491 --- /dev/null +++ b/SharpBenchmark.Wpf/ShellView.xaml @@ -0,0 +1,71 @@ + + + + + +