コード例 #1
0
        private models.Run Iteration(string benchmark, int iteration, bool isDryRun)
        {
            var dryRun = isDryRun ? " dryrun" : "";

            Logging.GetLogging().InfoFormat("Benchmarker | Benchmark{0} \"{1}\": start iteration {2}", dryRun, benchmark, iteration);
            GC.Collect(1);
            System.Threading.Thread.Sleep(5 * 1000);              // cool down?

            var sw = Stopwatch.StartNew();

            switch (benchmark)
            {
            case "bh":
                BH.Main(new string[] { "-b", "400", "-s", "200" }, Logging.GetLogging());
                break;

            case "binarytree":
                BinaryTrees.Main(new string[] { "17" }, Logging.GetLogging());
                break;

            case "bisort":
                BiSort.Main(new string[] { "-s", "1500000" }, Logging.GetLogging());
                break;

            case "euler":
                Euler.Main(new string[] { }, Logging.GetLogging());
                break;

            case "except":
                except.Main(new string[] { "500000" }, Logging.GetLogging());
                break;

            case "gcbridge-links":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-linkedfan":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-inversefan":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-deadlist":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-selflinks":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-spider":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-doublefan-1000":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "gcbridge-doublefan-4000":
                GcBridge.Main(new string[] { benchmark }, Logging.GetLogging());
                break;

            case "grandetracer":
                RayTracer.Main(new string[] { }, Logging.GetLogging());
                break;

            case "graph4":
                graph4.Node.Main(Logging.GetLogging());
                break;

            case "graph8":
                graph8.Node.Main(Logging.GetLogging());
                break;

            case "hash3":
                Hash3.Main(new string[] { "400000" }, Logging.GetLogging());
                break;

            case "health":
                Health.Main(new string[] { "-l", "10", "-t", "16" }, Logging.GetLogging());
                break;

            case "lists":
                Lists.Main(new string[] { "1000" }, Logging.GetLogging());
                break;

            case "mandelbrot":
                Mandelbrot.Main(new string[] { "1500" }, Logging.GetLogging());
                break;

            case "n-body":
                NBody.Main(new string[] { "400000" }, Logging.GetLogging());
                break;

            case "objinst":
                Objinst.Main(new string[] { "4000000" }, Logging.GetLogging());
                break;

            case "onelist":
                OneList.Main();
                break;

            case "perimeter":
                Perimeter.Main(new string[] { "-l", "17" }, Logging.GetLogging());
                break;

            case "raytracer2":
                RayTracer2.Main(new string[] { "120" }, Logging.GetLogging());
                break;

            case "raytracer3":
                RayTracer3.Main(new string[] { "120" }, Logging.GetLogging());
                break;

            case "scimark-fft":
                ScimarkEntrypoint.Main(new string[] { "fft" }, Logging.GetLogging());
                break;

            case "scimark-sor":
                ScimarkEntrypoint.Main(new string[] { "sor" }, Logging.GetLogging());
                break;

            case "scimark-mc":
                ScimarkEntrypoint.Main(new string[] { "mc" }, Logging.GetLogging());
                break;

            case "scimark-mm":
                ScimarkEntrypoint.Main(new string[] { "mm" }, Logging.GetLogging());
                break;

            case "scimark-lu":
                ScimarkEntrypoint.Main(new string[] { "lu" }, Logging.GetLogging());
                break;

            case "specraytracer":
                MainCL.Main(new string[] { "200", "1250" }, Logging.GetLogging());
                break;

            case "strcat":
                strcat.Main(new string[] { "40000000" });
                break;

            default:
                throw new NotImplementedException();
            }
            sw.Stop();
            Logging.GetLogging().InfoFormat("Benchmarker | Benchmark{0} \"{1}\": finished iteration {2}, took {3}ms", dryRun, benchmark, iteration, sw.ElapsedMilliseconds);
            var run = new models.Run {
                Benchmark = new models.Benchmark {
                    Name = benchmark
                }
            };

            run.RunMetrics.Add(
                new models.RunMetric {
                Metric = models.RunMetric.MetricType.Time,
                Value  = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds)
            }
                );
            return(run);
        }