示例#1
0
 private static void RunSelectedBenchmarks(BenchmarkType type)
 {
     if (type.HasFlag(BenchmarkType.Streams))
     {
         BenchmarkRunner.Run <ChannelsStreamsBenchmark>();
     }
 }
        public IBenchmark GetBenchmark(BenchmarkType benchmarkType, ModelDataType modelType)
        {
            switch (benchmarkType)
            {
            case BenchmarkType.Memcached:
                return(new MemcachedBenchmark());

            case BenchmarkType.MongoDB:
                return(GetMongoBenchmark(modelType));

            case BenchmarkType.Redis:
                return(GetRedisBenchmark(modelType));

            case BenchmarkType.Couchbase:
                return(new CouchbaaseBenchmark());

            case BenchmarkType.OrientDb:
                return(new OrientDbBenchmark());

            case BenchmarkType.Riak:
                return(new RiakBenchmark());

            default:
                throw new ArgumentOutOfRangeException(nameof(benchmarkType), benchmarkType, null);
            }
        }
示例#3
0
        private void ForwardClicked(object sender, EventArgs e)
        {
            BenchmarkType currentType = GetBenchmarkType();
            ChartForm     chart       = new ChartForm(currentType, MarkedTypes(), Start, Count, Step, Control);

            chart.ShowDialog();
        }
示例#4
0
        public static void Main(string[] args)
        {
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);

            if (result.Tag == ParserResultType.NotParsed)
            {
                return;
            }

            var           options = result.MapResult(o => o, xs => new Options());
            BenchmarkType b       = (BenchmarkType)options.Benchmark;

            if (b == BenchmarkType.Ycsb)
            {
                var test = new FASTER_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent, options.Backup);
                test.Run();
            }
            else if (b == BenchmarkType.SpanByte)
            {
                var test = new FasterSpanByteYcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent, options.Backup);
                test.Run();
            }
            else if (b == BenchmarkType.ConcurrentDictionaryYcsb)
            {
                var test = new ConcurrentDictionary_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent);
                test.Run();
            }
        }
示例#5
0
 public static Action<byte[], int, int> GetReadOrWriteAction(BenchmarkType type, Stream stream)
 {
     if (type.HasFlag(BenchmarkType.Read) && !type.HasFlag(BenchmarkType.Write))
         return ((bytes, i, length) => stream.Read(bytes, i, length));
     else if (type.HasFlag(BenchmarkType.Write) && !type.HasFlag(BenchmarkType.Read))
         return stream.Write;
     else
         throw new ArgumentException($"{nameof(type)}参数不能同时具有Write和Read标志。", nameof(type));
 }
示例#6
0
 public static void OpenFileStream(PartitionInfo partition, BenchmarkType benchmarkType, int bufferSize, Action<FileStream> work)
 {
     OpenFileHandle(partition, benchmarkType,
         handle =>
         {
             //打开文件流
             using (FileStream stream = new FileStream(handle, FileAccess.Read, bufferSize, false))
             {
                 work(stream);
             }
         });
 }
示例#7
0
文件: ChartForm.cs 项目: vosen/kora
 public ChartForm(BenchmarkType type, StructureType types, int start, int count, int step, int control)
 {
     InitializeComponent();
     var task = Task.Factory.StartNew(() => GenerateBenchmarks(type, types, start, count, step, control), TaskCreationOptions.LongRunning);
     task.ContinueWith(ancestor =>
     {
         foreach (var series in ConvertAllSeries(ancestor.Result, type == BenchmarkType.Memory))
             Chart.Series.Add(series);
         Chart.Visible = true;
         ProgressBarPanel.Visible = false;
         if ((type & BenchmarkType.Memory) > 0)
             Chart.ChartAreas[0].AxisY.Title = "Memory (MB)";
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
示例#8
0
 private static void RunSelectedBenchmarks(BenchmarkType type)
 {
     if (type.HasFlag(BenchmarkType.Enumerators))
     {
         BenchmarkRunner.Run <Enumerators>();
     }
     if (type.HasFlag(BenchmarkType.Throughput))
     {
         BenchmarkRunner.Run <PipeThroughput>();
     }
     if (type.HasFlag(BenchmarkType.ReadCursorOperations))
     {
         BenchmarkRunner.Run <ReadCursorOperationsThroughput>();
     }
 }
示例#9
0
        private static string GetBenchmarkType(Benchmark benchmark)
        {
            string benchmarkType = string.Empty;

            switch (benchmark.benchmarkType)
            {
            case BenchmarkType.Read:
                benchmarkType = "Reads";
                break;

            case BenchmarkType.Write:
                benchmarkType = "Writes";
                break;
            }
            return(benchmarkType);
        }
示例#10
0
        public static void Main(string[] args)
        {
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);

            if (result.Tag == ParserResultType.NotParsed)
            {
                return;
            }

            var           options = result.MapResult(o => o, xs => new Options());
            BenchmarkType b       = (BenchmarkType)options.Benchmark;

            if (b == BenchmarkType.Ycsb)
            {
                var test = new FASTER_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent, options.IpAddress, options.Port, options.SkipSetup);
                test.Run();
            }
        }
 public override IOSpeed GetTestResult(PartitionInfo partition, BenchmarkType type, BenchmarkFlags flags, CancellationToken cancellationToken)
 {
     var randomBenchmarkTimes = new TimeSpan[this.outstandingThreadsCount];
     BenchmarkFile.OpenFileHandle(partition, type,
         handle =>
         {
             Parallel.For(0, this.outstandingThreadsCount, i =>
             {
                 using (FileStream stream = new FileStream(handle, FileAccess.Read, BlockSize))
                 {
                     Action<byte[], int, int> work = Utility.GetReadOrWriteAction(type, stream);
                     randomBenchmarkTimes[i] = DoBenchmarkAlgorithm(stream, work, flags, cancellationToken);
                 }
             });
         });
     var totalTimes = randomBenchmarkTimes.Aggregate((a, b) => a + b);
     return new IOSpeed(time: totalTimes, ioCount: BlockCount, bytes: BlockCount * BlockSize);
 }
示例#12
0
        public ChartForm(BenchmarkType type, StructureType types, int start, int count, int step, int control)
        {
            InitializeComponent();
            var task = Task.Factory.StartNew(() => GenerateBenchmarks(type, types, start, count, step, control), TaskCreationOptions.LongRunning);

            task.ContinueWith(ancestor =>
            {
                foreach (var series in ConvertAllSeries(ancestor.Result, type == BenchmarkType.Memory))
                {
                    Chart.Series.Add(series);
                }
                Chart.Visible            = true;
                ProgressBarPanel.Visible = false;
                if ((type & BenchmarkType.Memory) > 0)
                {
                    Chart.ChartAreas[0].AxisY.Title = "Memory (MB)";
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
示例#13
0
        private MeasureResults GenerateBenchmarks(BenchmarkType type, StructureType types, int start, int count, int step, int control)
        {
            switch (type)
            {
            default:
            case BenchmarkType.Add:
                return(UAM.Kora.Benchmarking.MeasureSeriesAdd(types, start, count, step));

            case BenchmarkType.Delete:
                return(Benchmarking.MeasureSeriesDelete(types, start, count, step));

            case BenchmarkType.Search:
                return(Benchmarking.MeasureSeriesSearch(types, start, count, step, control));

            case BenchmarkType.Successor:
                return(Benchmarking.MeasureSeriesSuccessor(types, start, count, step, control));

            case BenchmarkType.Memory:
                return(Benchmarking.MeasureSeriesMemory(types, start, count, step));
            }
        }
示例#14
0
        public static void OpenFileHandle(PartitionInfo partition, BenchmarkType benchmarkType, Action<SafeFileHandle> work)
        {
            FileAccess fileAccess = (benchmarkType.HasFlag(BenchmarkType.Read) ? FileAccess.Read : new FileAccess()) | (benchmarkType.HasFlag(BenchmarkType.Write) ? FileAccess.Write : new FileAccess());
            string fullWorkDirectory = partition.DeviceId + workDirectory;
            string fileDirectory = $@"{fullWorkDirectory}\{fileName}";

            DeleteDirectory(fullWorkDirectory);             // 如果有,删除目录
            Directory.CreateDirectory(fullWorkDirectory);   // 创建测试目录            
            DecompressFolder(fullWorkDirectory);            // 将测试目录的压缩选项取消
            //打开文件句柄
            using (SafeFileHandle handle = NativeMethods.CreateFile(fileDirectory, fileAccess, FileShare.None, IntPtr.Zero, FileMode.OpenOrCreate, FileFlags, IntPtr.Zero))
            {
                int errorcode = Marshal.GetLastWin32Error();
                if (handle.IsInvalid)
                {
                    //TODO: 本地化
                    throw new IOException($"测试临时文件创建失败。错误:{errorcode}", new Win32Exception(errorcode));
                }
                work(handle);
            }
            DeleteDirectory(fullWorkDirectory);
        }
示例#15
0
        public static void Main(string[] args)
        {
            ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);

            if (result.Tag == ParserResultType.NotParsed)
            {
                return;
            }

            result.WithNotParsed(errs =>
            {
                var helpText = HelpText.AutoBuild(result, h =>
                {
                    return(HelpText.DefaultParsingErrorsHandler(result, h));
                }, e =>
                {
                    return(e);
                });
                Console.WriteLine(helpText);
            });

            var           options = result.MapResult(o => o, xs => new Options());
            BenchmarkType b       = (BenchmarkType)options.Benchmark;

            Console.WriteLine("Benchmark Arguments:");
            Console.WriteLine("  Benchmark = {0}", options.Benchmark);
            Console.WriteLine("  Number of threads = {0}", options.ThreadCount);
            Console.WriteLine("  Thread NUMA mapping = {0}", options.NumaStyle);
            Console.WriteLine("  Read percent = {0}", options.ReadPercent);
            Console.WriteLine("  Distribution = {0}", options.Distribution);


            if (b == BenchmarkType.Ycsb)
            {
                var test = new FASTER_YcsbBenchmark(options.ThreadCount, options.NumaStyle, options.Distribution, options.ReadPercent);
                test.Run();
            }
        }
        public List <Workload> GetBenchmarkType(BenchmarkType benchmrk)
        {
            List <Workload> wrkloadList = new List <Workload>();

            if (BenchmarkType.DVDTesting == benchmrk)
            {
                wrkloadList = ListOfWorkload.DVDTesting;
            }
            else if (BenchmarkType.DVDTraining == benchmrk)
            {
                wrkloadList = ListOfWorkload.DVDTraining;
            }
            else if (BenchmarkType.NDBenchTesting == benchmrk)
            {
                wrkloadList = ListOfWorkload.NDBTesting;
            }
            else if (BenchmarkType.NDBenchTraining == benchmrk)
            {
                wrkloadList = ListOfWorkload.NDBTraining;
            }

            return(wrkloadList);
        }
 public ExperimentParameters(int numberOfDimensions, int maximumNumberOfConstraints, int numberOfConstraintsCoefficients, EvolutionParameters evolutionParameters, int seed, bool trackEvolutionSteps, bool useRedundantConstraintsRemoving, bool useDataNormalization, bool allowQuadraticTerms, bool useSeeding, BenchmarkType typeOfBenchmark, double ballnBoundaryValue, double cubenBoundaryValue, double simplexnBoundaryValue, long numberOfDomainSamples, int numberOfTestPoints, int numberOfPositivePoints, int numberOfNegativePoints, double defaultDomainLowerLimit, double defaultDomainUpperLimit, int maxNumberOfPointsInSingleArray)
 {
     NumberOfDimensions              = numberOfDimensions;
     MaximumNumberOfConstraints      = maximumNumberOfConstraints;
     NumberOfConstraintsCoefficients = numberOfConstraintsCoefficients;
     EvolutionParameters             = evolutionParameters;
     Seed = seed;
     TrackEvolutionSteps             = trackEvolutionSteps;
     UseRedundantConstraintsRemoving = useRedundantConstraintsRemoving;
     UseDataNormalization            = useDataNormalization;
     AllowQuadraticTerms             = allowQuadraticTerms;
     UseSeeding                     = useSeeding;
     TypeOfBenchmark                = typeOfBenchmark;
     BallnBoundaryValue             = ballnBoundaryValue;
     CubenBoundaryValue             = cubenBoundaryValue;
     SimplexnBoundaryValue          = simplexnBoundaryValue;
     NumberOfDomainSamples          = numberOfDomainSamples;
     NumberOfTestPoints             = numberOfTestPoints;
     NumberOfPositivePoints         = numberOfPositivePoints;
     NumberOfNegativePoints         = numberOfNegativePoints;
     DefaultDomainLowerLimit        = defaultDomainLowerLimit;
     DefaultDomainUpperLimit        = defaultDomainUpperLimit;
     MaxNumberOfPointsInSingleArray = maxNumberOfPointsInSingleArray;
 }
示例#18
0
 public SimulationInfo(PredictorInfo predictorInfo, string benchmarkName, BenchmarkType benchmarkType)
 {
     this.predictorInfo = predictorInfo;
     this.benchmarkInfo = new BenchmarkInfo(benchmarkName, benchmarkType);
 }
示例#19
0
        public ExperimentParameters(
            int numberOfDimensions,

            int numberOfConstraints,

            int seed = Defaults.Seed,

            double domainSamplingStep = Defaults.DomainSamplingStep,

            double ballnBoundaryValue    = Defaults.BallnBoundaryValue,
            double cubenBoundaryValue    = Defaults.CubenBoundaryValue,
            double simplexnBoundaryValue = Defaults.SimplexnBoundaryValue,

            double globalLerningRate      = double.NaN,
            double individualLearningRate = double.NaN,
            double stepThreshold          = Defaults.StepThreshold,
            double rotationAngle          = Defaults.RotationAngle,
            MutationType typeOfMutation   = Defaults.TypeOfMutation,

            int numberOfParentsSolutionsToSelect    = Defaults.NumberOfParentsSolutionsToSelect,
            double partOfSurvivorsSolutionsToSelect = Defaults.PartOfSurvivorsSolutionsToSelect,
            SelectionType typeOfSurvivorsSelection  = Defaults.TypeOfSurvivorsSelection,

            int numberOfPositivePoints         = Defaults.NumberOfPositivePoints,
            int numberOfNegativePoints         = Defaults.NumberOfNegativePoints,
            double defaultDomainLowerLimit     = Defaults.DefaultDomainLowerLimit,
            double defaultDomainUpperLimit     = Defaults.DefaultDomainUpperLimit,
            bool usePointsGeneration           = Defaults.UsePointsGeneration,
            int maxNumberOfPointsInSingleArray = Defaults.MaxNumberOfPointsInSingleArray,

            int basePopulationSize           = Defaults.BasePopulationSize,
            int offspringPopulationSize      = Defaults.OffspringPopulationSize,
            int numberOfGenerations          = Defaults.NumberOfGenerations,
            int oneFifthRuleCheckInterval    = Defaults.OneFifthRuleCheckInterval,
            double oneFifthRuleScalingFactor = Defaults.OneFifthRuleScalingFactor,

            bool useRecombination = Defaults.UseRecombination,
            RecombinerType typeOfObjectsRecombiner       = Defaults.TypeOfObjectsRecombiner,
            RecombinerType typeOfStdDeviationsRecombiner = Defaults.TypeOfStdDeviationsRecombiner,
            RecombinerType typeOfRotationsRecombiner     = Defaults.TypeOfRotationsRecombiner,
            double partOfPopulationToRecombine           = Defaults.PartOfPopulationToRecombine,

            BenchmarkType typeOfBenchmark = Defaults.TypeOfBenchmark,
            List <Constraint> constraintsToPointsGeneration = Defaults.ConstraintsToPointsGeneration)
        {
            NumberOfDimensions = numberOfDimensions;

            NumberOfConstraints = numberOfConstraints;

            DomainSamplingStep = domainSamplingStep;

            Seed = seed;

            BallnBoundaryValue    = ballnBoundaryValue;
            CubenBoundaryValue    = cubenBoundaryValue;
            SimplexnBoundaryValue = simplexnBoundaryValue;

            GlobalLearningRate     = double.IsNaN(globalLerningRate) ? Defaults.GlobalLerningRate(numberOfDimensions) : globalLerningRate;
            IndividualLearningRate = double.IsNaN(individualLearningRate) ? Defaults.IndividualLearningRate(numberOfDimensions) : individualLearningRate;
            StepThreshold          = stepThreshold;
            RotationAngle          = rotationAngle;
            TypeOfMutation         = typeOfMutation;

            NumberOfParentsSolutionsToSelect = numberOfParentsSolutionsToSelect;
            PartOfSurvivorsSolutionsToSelect = partOfSurvivorsSolutionsToSelect;
            TypeOfSurvivorsSelection         = typeOfSurvivorsSelection;

            NumberOfPositivePoints = numberOfPositivePoints;
            NumberOfNegativePoints = numberOfNegativePoints;
            //DefaultDomainLimit = Tuple.Create(defaultDomainLowerLimit, defaultDomainUpperLimit);
            DefaultDomainLowerLimit        = defaultDomainLowerLimit;
            DefaultDomainUpperLimit        = defaultDomainUpperLimit;
            UsePointsGeneration            = usePointsGeneration;
            MaxNumberOfPointsInSingleArray = maxNumberOfPointsInSingleArray;

            BasePopulationSize        = basePopulationSize;
            OffspringPopulationSize   = offspringPopulationSize;
            NumberOfGenerations       = numberOfGenerations;
            OneFifthRuleCheckInterval = oneFifthRuleCheckInterval;
            OneFifthRuleScalingFactor = oneFifthRuleScalingFactor;

            UseRecombination              = useRecombination;
            TypeOfObjectsRecombiner       = typeOfObjectsRecombiner;
            TypeOfStdDeviationsRecombiner = typeOfStdDeviationsRecombiner;
            TypeOfRotationsRecombiner     = typeOfRotationsRecombiner;
            PartOfPopulationToRecombine   = partOfPopulationToRecombine;

            ConstraintsToPointsGeneration = constraintsToPointsGeneration;
            TypeOfBenchmark = typeOfBenchmark;
        }
 public Benchmark(BenchmarkType benchmarkType)
 {
     this.BenchmarkResults = new List <BenchmarkResult>();
     this.BenchmarkType    = benchmarkType;
 }
 public RunBenchmarkCommand()
 {
     this.IsCommand("run", "Run benchmark");
     this.HasOption<double>("factor|f=", "Multiplies the iteration count for each benchmark by this number. If benchmarks are running too fast or slow, experiment with this option. Minimum valid value is zero.", d => _factor = d);
     this.HasOption("static|instance", "Whether the benchmark should be against an instance or static member", option => _isStatic = option.ToLower() == "static");
     this.HasRequiredOption<BenchmarkType>("field|property", "The benchmark type", benchmarkType => _benchmarkType = benchmarkType);
     this.HasRequiredOption("value|reference", "Whether the benchmark should use a value type or a reference type", option => _isValueType = option.ToLower() == "value");
     this.HasOption("get|set", "Whether the benchmark should get or set its value", option => _isGet = option.ToLower() == "get");
 }
示例#22
0
 public Result(string label, BenchmarkType type)
 {
     _label = label;
     _type = type;
 }
        public BenchmarkFactory()
        {
            var ctor = BenchmarkType.DelegateForCtor <TBenchmark>(BenchmarkType.Module, typeof(IBenchmarkConfiguration));

            ConstructorInvoker = ctor;
        }
        public ExperimentParameters(
            int numberOfDimensions,

            int basePopulationSize,
            int offspringPopulationSize,
            int numberOfGenerations,

            int seed = EvolutionDefaults.Seed,
            bool trackEvolutionSteps             = EvolutionDefaults.TrackEvolutionSteps,
            bool useRedundantConstraintsRemoving = Defaults.UseRedundantConstraintsRemoving,
            bool useDataNormalization            = Defaults.UseDataNormalization,
            bool allowQuadraticTerms             = Defaults.AllowQuadraticTerms,
            bool useSeeding = Defaults.UseSeeding,

            ISet <TermType> allowedTermsTypes       = default(ISet <TermType>),
            BenchmarkType typeOfBenchmark           = Defaults.TypeOfBenchmark,
            double ballnBoundaryValue               = Defaults.BallnBoundaryValue,
            double cubenBoundaryValue               = Defaults.CubenBoundaryValue,
            double simplexnBoundaryValue            = Defaults.SimplexnBoundaryValue,
            IList <Constraint> referenceConstraints = default(IList <Constraint>),

            long numberOfDomainSamples         = Defaults.NumberOfDomainSamples,
            int numberOfTestPoints             = Defaults.NumberOfTestPoints,
            int numberOfPositivePoints         = Defaults.NumberOfPositivePoints,
            int numberOfNegativePoints         = Defaults.NumberOfNegativePoints,
            double defaultDomainLowerLimit     = Defaults.DefaultDomainLowerLimit,
            double defaultDomainUpperLimit     = Defaults.DefaultDomainUpperLimit,
            int maxNumberOfPointsInSingleArray = Defaults.MaxNumberOfPointsInSingleArray,

            double globalLearningRate     = double.NaN,
            double individualLearningRate = double.NaN,
            double stepThreshold          = EvolutionDefaults.StepThreshold,
            double rotationAngle          = EvolutionDefaults.RotationAngle,
            MutationType typeOfMutation   = EvolutionDefaults.TypeOfMutation,

            int numberOfParentsSolutionsToSelect            = EvolutionDefaults.NumberOfParentsSolutionsToSelect,
            ParentsSelectionType typeOfParentsSelection     = EvolutionDefaults.TypeOfParentsSelection,
            SurvivorsSelectionType typeOfSurvivorsSelection = EvolutionDefaults.TypeOfSurvivorsSelection,

            int oneFifthRuleCheckInterval    = EvolutionDefaults.OneFifthRuleCheckInterval,
            double oneFifthRuleScalingFactor = EvolutionDefaults.OneFifthRuleScalingFactor,

            bool useRecombination = EvolutionDefaults.UseRecombination,
            RecombinationType typeOfObjectsRecombination       = EvolutionDefaults.TypeOfObjectsRecombination,
            RecombinationType typeOfStdDeviationsRecombination = EvolutionDefaults.TypeOfStdDeviationsRecombination,
            RecombinationType typeOfRotationsRecombination     = EvolutionDefaults.TypeOfRotationsRecombination)
        {
            if (typeOfBenchmark == BenchmarkType.Other && referenceConstraints == default(IList <Constraint>))
            {
                throw new ArgumentException("In case of choosing BenchmarkType = Other, it is obligatory to provide reference constraints.");
            }

            AllowedTermsTypes = allowedTermsTypes == default(ISet <TermType>)
                ? Defaults.AllowedTermsTypes
                : allowedTermsTypes;

            //HACK
            //AllowedTermsTypes = new HashSet<TermType>
            //{
            //    TermType.Linear,
            //    TermType.Quadratic
            //};

            //NumberOfConstraintsCoefficients = numberOfDimensions * AllowedTermsTypes.Count + 1;

            NumberOfConstraintsCoefficients = typeOfBenchmark == BenchmarkType.Balln && allowQuadraticTerms
                ? numberOfDimensions * 2 + 1
                : numberOfDimensions + 1;

            //MaximumNumberOfConstraints = typeOfBenchmark == BenchmarkType.Other
            //    // ReSharper disable once PossibleNullReferenceException : It is checked before
            //    ? referenceConstraints.Count
            //    : GetMaximumNumberOfConstraints(numberOfDimensions, typeOfBenchmark, allowQuadraticTerms);

            //MaximumNumberOfConstraints = GetMaximumNumberOfConstraints(numberOfDimensions, typeOfBenchmark,
            //    allowQuadraticTerms);
            MaximumNumberOfConstraints = numberOfDimensions * numberOfDimensions;

            var objectVectorSize = NumberOfConstraintsCoefficients * MaximumNumberOfConstraints;

            NumberOfDimensions = numberOfDimensions;

            EvolutionParameters = new EvolutionParameters(
                objectVectorSize, basePopulationSize, offspringPopulationSize, numberOfGenerations, seed, trackEvolutionSteps,
                oneFifthRuleCheckInterval, oneFifthRuleScalingFactor, numberOfParentsSolutionsToSelect, (int)typeOfParentsSelection, (int)typeOfSurvivorsSelection,
                globalLearningRate, individualLearningRate, stepThreshold, rotationAngle, (int)typeOfMutation,
                useRecombination, (int)typeOfObjectsRecombination, (int)typeOfStdDeviationsRecombination, (int)typeOfRotationsRecombination);
            Seed = seed;
            TrackEvolutionSteps             = trackEvolutionSteps;
            UseRedundantConstraintsRemoving = useRedundantConstraintsRemoving;
            UseDataNormalization            = useDataNormalization;
            AllowQuadraticTerms             = allowQuadraticTerms;
            UseSeeding = useSeeding;

            TypeOfBenchmark       = typeOfBenchmark;
            BallnBoundaryValue    = ballnBoundaryValue;
            CubenBoundaryValue    = cubenBoundaryValue;
            SimplexnBoundaryValue = simplexnBoundaryValue;
            ReferenceConstraints  = referenceConstraints;

            NumberOfDomainSamples          = numberOfDomainSamples;
            NumberOfTestPoints             = numberOfTestPoints;
            NumberOfPositivePoints         = numberOfPositivePoints;
            NumberOfNegativePoints         = numberOfNegativePoints;
            DefaultDomainLowerLimit        = defaultDomainLowerLimit;
            DefaultDomainUpperLimit        = defaultDomainUpperLimit;
            MaxNumberOfPointsInSingleArray = maxNumberOfPointsInSingleArray;
        }
示例#25
0
        public Visualization(BenchmarkType benchmarkType)
        {
            Plots = new List <PlotView>();

            _colorKey  = new Dictionary <OxyColor, double>();
            _colorAxis = new RangeColorAxis {
                Key = ColorAxisName
            };

            var fieldInfos = typeof(OxyColors).GetFields(BindingFlags.Static | BindingFlags.Public);
            var rangeStart = 0.0;

            foreach (var fieldInfo in fieldInfos)
            {
                var oxyColor = (OxyColor)fieldInfo.GetValue(null);

                if (_colorKey.ContainsKey(oxyColor))
                {
                    continue;
                }

                _colorAxis.AddRange(rangeStart, rangeStart + 0.1, oxyColor);
                _colorKey.Add(oxyColor, rangeStart);
                rangeStart++;
            }

            switch (benchmarkType)
            {
            case BenchmarkType.Balln:
                _plotWidth  = 400;
                _plotHeight = 400;
                _xAxisMin   = -5;
                _xAxisMax   = 7;
                _yAxisMin   = -4;
                _yAxisMax   = 8;
                break;

            case BenchmarkType.Cuben:
                _plotWidth  = 400;
                _plotHeight = 400;
                _xAxisMin   = -2;
                _xAxisMax   = 6.6;
                _yAxisMin   = -4.5;
                _yAxisMax   = 13.5;
                break;

            case BenchmarkType.Simplexn:
                _plotWidth  = 400;
                _plotHeight = 400;
                _xAxisMin   = -1.5;
                _xAxisMax   = 5;
                _yAxisMin   = -1.5;
                _yAxisMax   = 5;
                break;

            case BenchmarkType.Other:
                _plotWidth  = 400;
                _plotHeight = 400;
                _xAxisMin   = -100;
                _xAxisMax   = 100;
                _yAxisMin   = -100;
                _yAxisMax   = 100;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(benchmarkType), benchmarkType, null);
            }

            Application.EnableVisualStyles();
        }
 public CompareTypesByEnvironmentViewModel(IList <BenchmarkType> types)
 {
     Types      = types;
     TargetType = Types.First();
 }
示例#27
0
 public CompareTypesByCommitViewModel(BenchmarkType left, BenchmarkType right)
 {
     Left  = left;
     Right = right;
 }
示例#28
0
文件: ChartForm.cs 项目: vosen/kora
 private MeasureResults GenerateBenchmarks(BenchmarkType type, StructureType types, int start, int count, int step, int control)
 {
     switch (type)
     {
         default:
         case BenchmarkType.Add:
             return UAM.Kora.Benchmarking.MeasureSeriesAdd(types, start, count, step);
         case BenchmarkType.Delete:
             return Benchmarking.MeasureSeriesDelete(types, start, count, step);
         case BenchmarkType.Search:
             return Benchmarking.MeasureSeriesSearch(types, start, count, step, control);
         case BenchmarkType.Successor:
             return Benchmarking.MeasureSeriesSuccessor(types, start, count, step, control);
         case BenchmarkType.Memory:
             return Benchmarking.MeasureSeriesMemory(types, start, count, step);
     }
 }
示例#29
0
 /// <summary>
 /// 根据核心测试算法返回的时间计算结果。
 /// </summary>
 /// <param name="partition">测试分区</param>
 /// <param name="arg">测试类型</param>
 /// <param name="flags">测试所需参数</param>
 /// <param name="cancellationToken">用以取消工作的取消标记</param>
 /// <returns></returns>
 public virtual IOSpeed GetTestResult(PartitionInfo partition, BenchmarkType type, BenchmarkFlags flags, CancellationToken cancellationToken)
 {
     TimeSpan result = new TimeSpan();
     BenchmarkFile.OpenFileStream(partition, type, BlockSize,
         stream =>
         {
             Action<byte[], int, int> work = GetReadOrWriteAction(type, stream);
             result = DoBenchmarkAlgorithm(stream, work, flags, cancellationToken);
         });
     return new IOSpeed(time: result, ioCount: BlockCount, bytes: BlockCount * BlockSize);
 }
示例#30
0
 /// <summary>
 /// Makes the benchmark run for a number of hours
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Hours()
 {
     _type = BenchmarkType.Hours;
     return _benchmark.Run();
 }
示例#31
0
 /// <summary>
 /// Makes the benchmark run for a number of seconds
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Seconds()
 {
     _type = BenchmarkType.Seconds;
     return _benchmark.Run();
 }
示例#32
0
 /// <summary>
 /// Makes the benchmark run for a number of minutes
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Minutes()
 {
     _type = BenchmarkType.Minutes;
     return _benchmark.Run();
 }
示例#33
0
 /// <summary>
 /// Makes the benchmark use a number of iterations
 /// </summary>
 /// <value>The iterations.</value>
 public Result[] Iterations()
 {
     _type = BenchmarkType.Iterations;
     return(_benchmark.Run());
 }
示例#34
0
 public Result(string label, BenchmarkType type)
 {
     _label = label;
     _type  = type;
 }
示例#35
0
 public RunBenchmarkCommand()
 {
     this.IsCommand("run", "Run benchmark");
     this.HasOption <double>("factor|f=", "Multiplies the iteration count for each benchmark by this number. If benchmarks are running too fast or slow, experiment with this option. Minimum valid value is zero.", d => _factor = d);
     this.HasOption("static|instance", "Whether the benchmark should be against an instance or static member", option => _isStatic = option.ToLower() == "static");
     this.HasRequiredOption <BenchmarkType>("field|property", "The benchmark type", benchmarkType => _benchmarkType = benchmarkType);
     this.HasRequiredOption("value|reference", "Whether the benchmark should use a value type or a reference type", option => _isValueType = option.ToLower() == "value");
     this.HasOption("get|set", "Whether the benchmark should get or set its value", option => _isGet = option.ToLower() == "get");
 }
示例#36
0
 /// <summary>
 /// Makes the benchmark run for a number of seconds
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Seconds()
 {
     _type = BenchmarkType.Seconds;
     return(_benchmark.Run());
 }
示例#37
0
 /// <summary>
 /// Makes the benchmark run for a number of minutes
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Minutes()
 {
     _type = BenchmarkType.Minutes;
     return(_benchmark.Run());
 }
示例#38
0
 /// <summary>
 /// Makes the benchmark run for a number of hours
 /// </summary>
 /// <value>The benchmark</value>
 public Result[] Hours()
 {
     _type = BenchmarkType.Hours;
     return(_benchmark.Run());
 }
示例#39
0
        private static ExperimentParameters GetExperimentParameters(int numberOfDimensions, int offspringPopulationSize, int numberOfGenerations, int seed, BenchmarkType typeOfBenchmark, bool allowQuadraticTerms, int numberOfPositivePoints, bool useDataNormalization, bool useSeeding)
        {
            return(new ExperimentParameters(
                       numberOfDimensions: numberOfDimensions,
                       basePopulationSize: 100,
                       offspringPopulationSize: offspringPopulationSize,
                       numberOfGenerations: numberOfGenerations,
                       seed: seed,
                       typeOfBenchmark: typeOfBenchmark,

                       trackEvolutionSteps: false,
                       useRedundantConstraintsRemoving: true,
                       useDataNormalization: useDataNormalization,
                       allowQuadraticTerms: allowQuadraticTerms,
                       useSeeding: useSeeding,

                       ballnBoundaryValue: 2.7,
                       cubenBoundaryValue: 2.7,
                       simplexnBoundaryValue: 2.7,

                       numberOfDomainSamples: 100000,
                       numberOfTestPoints: 100000,
                       numberOfPositivePoints: numberOfPositivePoints,
                       numberOfNegativePoints: numberOfPositivePoints * numberOfDimensions * numberOfDimensions,
                       maxNumberOfPointsInSingleArray: 800000,

                       globalLearningRate: EvolutionDefaults.GlobalLearningRate(numberOfDimensions),
                       individualLearningRate: EvolutionDefaults.IndividualLearningRate(numberOfDimensions),
                       stepThreshold: 0.0001,
                       rotationAngle: EvolutionDefaults.RotationAngle,
                       typeOfMutation: MutationType.Correlated,

                       numberOfParentsSolutionsToSelect: 5,
                       typeOfParentsSelection: ParentsSelectionType.Even,
                       typeOfSurvivorsSelection: SurvivorsSelectionType.Distinct,

                       //oneFifthRuleCheckInterval: 5,
                       //oneFifthRuleScalingFactor: 0.9,

                       useRecombination: false,
                       typeOfObjectsRecombination: RecombinationType.Discrete,
                       typeOfStdDeviationsRecombination: RecombinationType.Intermediate,
                       typeOfRotationsRecombination: RecombinationType.Intermediate
                       ));
        }
示例#40
0
 /// <summary>
 /// Makes the benchmark use a number of iterations
 /// </summary>
 /// <value>The iterations.</value>
 public Result[] Iterations()
 {
     _type = BenchmarkType.Iterations;
     return _benchmark.Run();
 }
 /// <summary>
 /// Runs a specific benchmark for a specified number of seconds.
 /// </summary>
 /// <param name="Benchmark">Type of Benchmark to run.</param>
 private void RunSingleBenchmark(BenchmarkType Benchmark)
 {
     CanStartBenchmark = false;
     BenchmarkResults Results = new BenchmarkResults();
     DateTime StartTime, EndTime;
     TableViewModel tempMasterViewModel = new TableViewModel();
     #region Temp MasterViewModel Settings
     tempMasterViewModel.HouseRulesVM.DecksInShoe = 7;
     tempMasterViewModel.HouseRulesVM.ShoePenetration = 0.75;
     #endregion
     Results.Type = Benchmark;
     Results.Iterations = 0;
     StartTime = DateTime.Now;
     EndTime = StartTime.AddSeconds(SecondsPerBenchmark);
     switch (Benchmark) {
         case BenchmarkType.CreateShoeFisherYates:
             #region Create Shoe - Fisher-Yates Shuffle
             Results.Name = "Create Shoe - Fisher-Yates Shuffle";
             tempMasterViewModel.HouseRulesVM.ShuffleMode = ShuffleMode.FisherYates;
             while (DateTime.Now < EndTime) {
                 ShoeViewModel Shoe = new ShoeViewModel(tempMasterViewModel, true);
                 Results.Iterations++;
             }
             break;
             #endregion
         case BenchmarkType.NoShuffle:
             #region Create Shoe - No Shuffle
             Results.Name = "Create Shoe - No Shuffle";
             tempMasterViewModel.HouseRulesVM.ShuffleMode = ShuffleMode.NoShuffle;
             while (DateTime.Now < EndTime) {
                 ShoeViewModel Shoe = new ShoeViewModel(tempMasterViewModel, true);
                 Results.Iterations++;
             }
             break;
             #endregion
     }
     Results.RunTime = DateTime.Now.Subtract(StartTime).TotalMilliseconds / 1000;
     Results.IterationsPerSecond = Math.Round(Results.Iterations / Results.RunTime, 2);
     Results.RunTime = Math.Round(Results.RunTime, 2);
     BenchmarkData[Benchmark] = Results;
     m_Parent.LoggingVM.AddItem(LogActionType.Benchmark, Results);
     OnPropertyChanged("DataTable");
     tempMasterViewModel.Dispose();
     CanStartBenchmark = true;
 }
示例#42
0
 public BenchmarkInfo(string benchmarkName, BenchmarkType benchmarkType)
 {
     this.benchmarkName = benchmarkName;
     this.benchmarkType = benchmarkType;
 }