Beispiel #1
0
        public List <BenchmarkResult> DoBenchmark(params Model.Modules.Types.BenchmarkType[] BenchmarkTypes)
        {
            if (BenchmarkTypes == null)
            {
                throw new Exception("BenchmarkType could not be empty");
            }

            List <BenchmarkResult> BenchmarkResultList = new List <BenchmarkResult>();
            int percentage = 0;

            for (int i = 0; i < BenchmarkTypes.Length; i++)
            {
                var benchmarkModule = Factory.Main.GetModuleByType(BenchmarkTypes[i], this._ConfigurationParameters);

                AttachEvents(ref benchmarkModule, true);
                var benchmarkResultPartial = benchmarkModule.DoBenchmark();
                benchmarkResultPartial.BenchmarkType = BenchmarkTypes[i];
                BenchmarkResultList.Add(benchmarkResultPartial);
                AttachEvents(ref benchmarkModule, false);

                OnProgressChanged.DynamicInvoke(Math.Round(((double)(i + 1) / (double)BenchmarkTypes.Length) * 100, 2));
            }


            return(BenchmarkResultList);
        }