public BenchmarkRunner(ICache cache, IBenchmark benchmark)
 {
     _cache = cache;
     _benchmark = benchmark;
     _singleMeasurer = new SingleThreadedBenchmarkMeasurer(cache, benchmark);
     _multiMeasurer = new MultiThreadedBenchmarkMeasurer(cache, benchmark);
 }
示例#2
0
 public BenchmarkRunner(IContainerAdapter container, IBenchmark benchmark)
 {
     this.container = container;
     this.benchmark = benchmark;
     this.singlethreadedMeasurer = new SinglethreadedBenchmarkMeasurer(container, benchmark);
     this.multithreadedMeasurer = new MultithreadedBenchmarkMeasurer(container, benchmark);
 }
示例#3
0
 private static bool ShouldRun(Regex filter, IBenchmark benchmark)
 {
     if (filter == null) return true;
     var name = benchmark.GetType().Name;
     var shouldRun = filter.IsMatch(name);
     return shouldRun;
 }
示例#4
0
 private static void Main(string[] args)
 {
     var client = new Client("10.211.55.2");
     Stats.MethodExecuted += (sender, info) => client.SendEvent(info.MethodBase.ToString(), String.Empty, String.Empty, (float)info.TimeSpan.Ticks / 10);
     WireUpHistograms();
     var benchmarks = new IBenchmark[] {new SagaPersisterBenchmark(), new OutboxPersisterBenchmark(), new TimeoutPersisterBenchmark() };
     const int iterations = 1000;
     Console.WriteLine("Executing benchmarks. Please wait...");
     const string outfile = "log.csv";
     var writeheaders = !File.Exists(outfile);
     if (!File.Exists(outfile))
     {
     }
     new Timer(o => PrintHistograms(), null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30));
     for(var runIdx = 0; runIdx < 10; runIdx++)
     {
         using (var stream = File.AppendText(outfile)) {
             if (writeheaders) {
                 stream.WriteLine("Header,StartTime,Minimum,Maximum,Mean,95th Percentile,99th Percentile");
             }
             foreach (var benchmark in benchmarks) {
                 Console.WriteLine("Executing benchmarks in {0}...", benchmark.GetType().Name);
                 foreach (var timingInfo in benchmark.Execute(iterations)) {
                     Console.WriteLine("{0} Min: {1}us, Max: {2}us, 95%: {3}us, 99%: {4}us", timingInfo.Name,
                         timingInfo.Histogram.getMinValue(),
                         timingInfo.Histogram.getMaxValue(), timingInfo.Histogram.getValueAtPercentile(95),
                         timingInfo.Histogram.getValueAtPercentile(99));
                     stream.WriteLine("{0},{1},{2},{3},{4},{5},{6}", timingInfo.Name, timingInfo.StartTime.ToString("o"), timingInfo.Histogram.getMinValue(), timingInfo.Histogram.getMaxValue(), timingInfo.Histogram.getMean(), timingInfo.Histogram.getValueAtPercentile(95), timingInfo.Histogram.getValueAtPercentile(99));
                 }
             }
         }
     }
 }
示例#5
0
 protected void Run(IBenchmark benchmark, Func<IBenchmark, long> function)
 {
     if (ShouldRun(filter, benchmark))
     {
         output.Write(function(benchmark) + "\t");
     }
     else
     {
         output.Write("0\t");
     }
 }
 private void PrintResult(IBenchmark test, Stopwatch stopwatch)
 {
     if (results == Results.Total_time)
     {
         Console.WriteLine(" Hey {0,-20} - you did it in {1,10}", test.GetType().Name, stopwatch.Elapsed);
     }
     else
     {
         Console.WriteLine(" Hey {0,-20} - you did {1,10} operations per second", test.GetType().Name,
                           (iterations*oneSecondTicks)/stopwatch.Elapsed.Ticks);
     }
 }
示例#7
0
 private long RunContinuously(IBenchmark test)
 {
     Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
     for (var i = 0; i < iterations; i++)
     {
         test.Run();
     }
     PrintResult(test);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return 0;
 }
 private long RunSingleThread(IBenchmark test)
 {
     var stopwatch = Stopwatch.StartNew();
     for (var i = 0; i < iterations; i++)
     {
         test.Run();
     }
     stopwatch.Stop();
     PrintResult(test, stopwatch);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return stopwatch.ElapsedMilliseconds;
 }
 public void Run(IBenchmark benchmark)
 {
     Console.WriteLine("For " + benchmark.Name + ":");
     benchmark.VerifyAssertions();
     benchmark.Benchmark(); // First run outside of timing to avoid any warm up side effect
     GC.Collect(); // Collect before run to avoid any GC effects during run
     Stopwatch watch = new Stopwatch();
     watch.Start();
     for (int i = 0; i < iterations; i++)
     {
         benchmark.Benchmark();
     }
     watch.Stop();
     Console.WriteLine("Elapsed: {0}", watch.Elapsed);
     Console.WriteLine("Call/ms: {0}", iterations / watch.ElapsedMilliseconds);
     _results.Add(new BenchmarkResult(benchmark.Name, watch.ElapsedMilliseconds));
 }
示例#10
0
 private long RunWithStop(IBenchmark test)
 {
     Console.WriteLine(" Testing {0,-20}", test.GetType().Name);
     var count = 0;
     for (var i = 0; i < iterations; i++)
     {
         count++;
         test.Run();
         if (count == memorySnapshotStep)
         {
             CollectSnapshot(i);
             count = 0;
         }
     }
     PrintResult(test);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return 0;
 }
示例#11
0
 private void PrintResult(IBenchmark test)
 {
     Console.WriteLine(" Hey {0,-20} - you're done. Collect snapshot and proceed with enter", test.GetType().Name);
     Console.ReadLine();
 }
 public MultithreadedBenchmarkMeasurer(IContainerAdapter container, IBenchmark benchmark) : base(container, benchmark)
 {
 }
示例#13
0
        private static string GenerateTestSourceCode(IBenchmark bench)
        {
            StringWriter sw = new StringWriter();

            sw.WriteLine("using System;");

            sw.WriteLine(bench.Header);

            sw.WriteLine("public class TheBenchmark {");
            sw.WriteLine("static TheBenchmark() {");
            sw.WriteLine("}");
            sw.WriteLine(bench.CreateSource("logger1", "nosuchlogger"));
            sw.WriteLine(bench.CreateSource("logger2", "null1"));
            sw.WriteLine(bench.CreateSource("logger3", "null2"));
            sw.WriteLine(bench.CreateSource("logger4", "file1"));
            sw.WriteLine(bench.CreateSource("logger5", "file3"));
            sw.WriteLine(bench.CreateSource("logger6", "file2"));

            sw.WriteLine("public static void Init() {");
            //sw.WriteLine("Console.WriteLine(\"Init\");");
            sw.WriteLine(bench.Init);
            sw.WriteLine("} // Init()");
            sw.WriteLine("public static void Flush() {");
            //sw.WriteLine("Console.WriteLine(\"Flushing\");");
            sw.WriteLine(bench.Flush);
            //sw.WriteLine("Console.WriteLine(\"Flushed\");");
            sw.WriteLine("} // Flush()");
            sw.WriteLine("public static void DoNothing() {");
            sw.WriteLine("} // DoNothing()");
            sw.WriteLine("public static void NoLogging() {");
            sw.WriteLine(bench.WriteUnformatted("logger1", "Debug", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger1", "Info", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger1", "Warn", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger1", "Error", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger1", "Fatal", "Lorem Ipsum"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoLoggingWithFormatting1() {");
            sw.WriteLine(bench.WriteFormatted("logger1", "Debug", "Lorem Ipsum", "1"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Info", "Lorem Ipsum", "2"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Warn", "Lorem Ipsum", "3"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Error", "Lorem Ipsum", "4"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Fatal", "Lorem Ipsum", "5"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoLoggingWithFormatting2() {");
            sw.WriteLine(bench.WriteFormatted("logger1", "Debug", "Lorem Ipsum", "1,2"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Info", "Lorem Ipsum", "2,3"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Warn", "Lorem Ipsum", "3,4"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Error", "Lorem Ipsum", "4,5"));
            sw.WriteLine(bench.WriteFormatted("logger1", "Fatal", "Lorem Ipsum", "5,6"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoLoggingWithFormatting3() {");
            sw.WriteLine(bench.WriteFormatted("logger1", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger1", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger1", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger1", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger1", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void GuardedNoLogging() {");
            sw.WriteLine(bench.GuardedWrite("logger1", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.GuardedWrite("logger1", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.GuardedWrite("logger1", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.GuardedWrite("logger1", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.GuardedWrite("logger1", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void NullLoggingWithoutFormatting() {");
            sw.WriteLine(bench.WriteUnformatted("logger2", "Debug", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger2", "Info", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger2", "Warn", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger2", "Error", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger2", "Fatal", "Lorem Ipsum"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NullLoggingWithFormatting1() {");
            sw.WriteLine(bench.WriteFormatted("logger2", "Debug", "Lorem Ipsum", "1"));
            sw.WriteLine(bench.WriteFormatted("logger2", "Info", "Lorem Ipsum", "2"));
            sw.WriteLine(bench.WriteFormatted("logger2", "Warn", "Lorem Ipsum", "3"));
            sw.WriteLine(bench.WriteFormatted("logger2", "Error", "Lorem Ipsum", "4"));
            sw.WriteLine(bench.WriteFormatted("logger2", "Fatal", "Lorem Ipsum", "5"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NullLoggingWithFormatting3() {");
            sw.WriteLine(bench.WriteFormatted("logger2", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger2", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger2", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger2", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger2", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoRenderingLoggingWithoutFormatting() {");
            sw.WriteLine(bench.WriteUnformatted("logger3", "Debug", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger3", "Info", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger3", "Warn", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger3", "Error", "Lorem Ipsum"));
            sw.WriteLine(bench.WriteUnformatted("logger3", "Fatal", "Lorem Ipsum"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoRenderingLoggingWithFormatting1() {");
            sw.WriteLine(bench.WriteFormatted("logger3", "Debug", "Lorem Ipsum", "1"));
            sw.WriteLine(bench.WriteFormatted("logger3", "Info", "Lorem Ipsum", "2"));
            sw.WriteLine(bench.WriteFormatted("logger3", "Warn", "Lorem Ipsum", "3"));
            sw.WriteLine(bench.WriteFormatted("logger3", "Error", "Lorem Ipsum", "4"));
            sw.WriteLine(bench.WriteFormatted("logger3", "Fatal", "Lorem Ipsum", "5"));
            sw.WriteLine("}");
            sw.WriteLine("public static void NoRenderingLoggingWithFormatting3() {");
            sw.WriteLine(bench.WriteFormatted("logger3", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger3", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger3", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger3", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger3", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void SimpleFile() {");
            sw.WriteLine(bench.WriteFormatted("logger4", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger4", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger4", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger4", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger4", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void BufferedFile() {");
            sw.WriteLine(bench.WriteFormatted("logger5", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger5", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger5", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger5", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger5", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("public static void AsyncFile() {");
            sw.WriteLine(bench.WriteFormatted("logger6", "Debug", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger6", "Info", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger6", "Warn", "Lorem Ipsum", "false,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger6", "Error", "Lorem Ipsum", "1,2,\"test\""));
            sw.WriteLine(bench.WriteFormatted("logger6", "Fatal", "Lorem Ipsum", "true,2,\"test\""));
            sw.WriteLine("}");
            sw.WriteLine("}");
            return sw.ToString();
        }
示例#14
0
 public GeneticOptimization(IBenchmark <Configuration> benchmark, Configuration baseConfiguration)
 {
     this.benchmark         = benchmark;
     this.baseConfiguration = baseConfiguration;
 }
示例#15
0
        public void Init(ParsingContext context, ParseTreeNode parseNode, IGraphDS myGraphDS)
        {
            base.InitNode(context, parseNode, myGraphDS);
            _pluginManager.Discover();

            _componentName = parseNode.ChildNodes[1].Token.ValueString;

            if (base.CheckForComponent<IBenchmark>(_componentName, context, parseNode.ChildNodes[1].Token.Location))
            {
                if (parseNode.ChildNodes[2].ChildNodes.Count > 0)
                {
                    try
                    {
                        _iterations = Convert.ToInt64(parseNode.ChildNodes[2].ChildNodes[2].Token.ValueString);
                    }
                    catch(Exception)
                    {
                        context.AddParserMessage(ParserErrorLevel.Error, parseNode.ChildNodes[2].ChildNodes[2].Token.Location, "This is not a valid iteration count");
                        return;
                    }
                }

                Dictionary<String, String> options;
                if (parseNode.ChildNodes[3].ChildNodes.Count > 0)
                {
                    options = ((OptionsNode)(parseNode.ChildNodes[3].AstNode)).Options;
                }
                else
                {
                    options = new Dictionary<String, String>();
                }

                _benchmark = _pluginManager.GetAndInitializePlugin<IBenchmark>(
                    _componentName,
                    base.PreparePluginOptions(options, _graphDS));
            }
        }
 public static ChartData BuildChartDataForMethodCall(
     IBenchmark benchmark, int repetitionsCount)
 {
     return(BuildChartsDataForClasses(benchmark, repetitionsCount, true, "Call method with argument"));
 }
示例#17
0
 protected BenchmarkMeasurer(IContainerAdapter container, IBenchmark benchmark)
 {
     this.Container = container;
     this.Benchmark = benchmark;
 }
示例#18
0
 public BenchmarkResult(IBenchmark benchmark, IContainerAdapter container)
 {
     this.BenchmarkInfo = new BenchmarkInfo(benchmark);
     this.ContainerInfo = new ContainerAdapterInfo(container);
 }
 public BenchmarkResult(IBenchmark benchmark, ICache cache)
 {
     Benchmark = benchmark;
     Cache = cache;
 }
示例#20
0
 public BenchmarkTester(IBenchmark benchmark, decimal iterations)
 {
     _benchmark = benchmark;
     _iterations = iterations;
 }
 protected BaseMeasurer(ICache cache, IBenchmark benchmark)
 {
     _cache = cache;
     _benchmark = benchmark;
 }
 private long RunThreadBased(IBenchmark test)
 {
     var stopwatch = Stopwatch.StartNew();
     var threads = new Thread[Environment.ProcessorCount];
     var interval = iterations/threads.Length;
     for (var i = 0; i < threads.Length; i++)
     {
         var thread = new Thread(() =>
                                     {
                                         for (var j = 0; j < interval; j++)
                                         {
                                             test.Run();
                                         }
                                     });
         threads[i] = thread;
         thread.Start();
     }
     for (var i = 0; i < threads.Length; i++)
     {
         threads[i].Join();
     }
     stopwatch.Stop();
     PrintResult(test, stopwatch);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return stopwatch.ElapsedMilliseconds;
 }
示例#23
0
 public BenchmarkInfo(IBenchmark benchmark)
 {
     this.Name = benchmark.Name;
     this.FullName = benchmark.GetType().FullName;
 }
 public static ChartData BuildChartDataForArrayCreation(
     IBenchmark benchmark, int repetitionsCount)
 {
     return(BuildChartsDataForClasses(benchmark, repetitionsCount, false, "Create array"));
 }
示例#25
0
        private static void DoBenchmark(XmlTextWriter xtw, IBenchmark b)
        {
            Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider();

            Console.WriteLine("Benchmark: {0}", b.Name);

            if (File.Exists("BenchmarkAssembly." + b.Name + ".dll"))
                File.Delete("BenchmarkAssembly." + b.Name + ".dll");

            CompilerParameters options = new CompilerParameters();
            options.OutputAssembly = "BenchmarkAssembly." + b.Name + ".dll";
            options.GenerateInMemory = true;
            options.GenerateExecutable = false;
            foreach (string s in b.References)
                options.ReferencedAssemblies.Add(s);
            options.CompilerOptions = "/optimize+";
            //options.IncludeDebugInformation = true;

            string sourceCode = GenerateTestSourceCode(b);
            
            using (StreamWriter sw = File.CreateText("BenchmarkAssembly." + b.Name + ".cs"))
            {
                sw.Write(sourceCode);
            }

            CompilerResults results = provider.CreateCompiler().CompileAssemblyFromSource(options, sourceCode);
            foreach (CompilerError ce in results.Errors)
            {
                Console.WriteLine("ERROR in line {0}: {1}", ce.Line, ce.ErrorText);
            }
            if (results.Errors.Count > 0)
            {
                Console.WriteLine("Errors in generated code for " + b.Name + " Ignoring.");
                return;
            }

            //Console.WriteLine("Compiled to assembly: {0}", results.CompiledAssembly.FullName);
            xtw.WriteStartElement("framework");
            xtw.WriteAttributeString("name", b.Name);

            Type t = results.CompiledAssembly.GetType("TheBenchmark");

            double min, max, avg;

            TimeAndDiscardUnusual(null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "DoNothing"), null, 100000, 10, out min, out max, out avg);
            _overhead = min;

            Console.WriteLine("overhead: {0}", _overhead);

            RunDelegate init = (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "Init");
            RunDelegate flush = (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "Flush");

            init();

            TimeAndDisplay("Guarded no logging", xtw, null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "GuardedNoLogging"), null, 100000, 5);
            TimeAndDisplay("Unguarded no logging", xtw, null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoLogging"), null, 100000, 5);
            TimeAndDisplay("Unguarded no logging with formatting 1", xtw, null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoLoggingWithFormatting1"), null, 10000, 5);
            TimeAndDisplay("Unguarded no logging with formatting 2", xtw, null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoLoggingWithFormatting2"), null, 10000, 5);
            TimeAndDisplay("Unguarded no logging with formatting 3", xtw, null, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoLoggingWithFormatting3"), null, 10000, 5);
            TimeAndDisplay("Null target without rendering", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoRenderingLoggingWithoutFormatting"), flush, 10000, 5);
            TimeAndDisplay("Null target without rendering 1", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoRenderingLoggingWithFormatting1"), flush, 10000, 5);
            TimeAndDisplay("Null target without rendering 3", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NoRenderingLoggingWithFormatting3"), flush, 10000, 5);
            TimeAndDisplay("Null target with rendering", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NullLoggingWithoutFormatting"), flush, 1000, 5);
            TimeAndDisplay("Null target with rendering 1", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NullLoggingWithFormatting1"), flush, 1000, 5);
            TimeAndDisplay("Null target with rendering 3", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "NullLoggingWithFormatting3"), flush, 1000, 5);
            TimeAndDisplay("Simple file", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "SimpleFile"), flush, 10, 5);
            //TimeAndDisplay("Buffered file", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "BufferedFile"), flush, 100, 5);
            //TimeAndDisplay("Asynchronous File without a flush", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "AsyncFile"), null, 100, 5);
            //flush();
            //TimeAndDisplay("Asynchronous File with a flush", xtw, init, (RunDelegate)Delegate.CreateDelegate(typeof(RunDelegate), t, "AsyncFile"), flush, 5000, 5);

            xtw.WriteEndElement();
        }
 public BenchmarkInfo(IBenchmark benchmark)
 {
     this.Name     = benchmark.Name;
     this.FullName = benchmark.GetType().FullName;
 }
 private long RunTaskBased(IBenchmark test)
 {
     var stopwatch = Stopwatch.StartNew();
     var tasks = new Task[iterations];
     for (var i = 0; i < tasks.Length; i++)
     {
         tasks[i] = Task.Factory.StartNew(test.Run);
     }
     Task.WaitAll(tasks);
     stopwatch.Stop();
     PrintResult(test, stopwatch);
     var disposable = test as IDisposable;
     if (disposable != null)
     {
         disposable.Dispose();
     }
     return stopwatch.ElapsedMilliseconds;
 }
 public MultiThreadedBenchmarkMeasurer(ICache cache, IBenchmark benchmark)
     : base(cache, benchmark)
 {
 }