Exemplo n.º 1
0
        void NextBenchmark()
        {
            if (_bechmarkCurrentIndex > -1)
            {
                StepUpBenchmarkStepProgress();
            }
            ++_bechmarkCurrentIndex;
            if (_bechmarkCurrentIndex >= _benchmarkAlgorithmsCount)
            {
                EndBenchmark();
                return;
            }

            Tuple <ComputeDevice, Queue <Algorithm> > currentDeviceAlgosTuple;
            Queue <Algorithm> algorithmBenchmarkQueue;

            while (_benchmarkDevicesAlgorithmQueue.Count > 0)
            {
                currentDeviceAlgosTuple = _benchmarkDevicesAlgorithmQueue[0];
                _currentDevice          = currentDeviceAlgosTuple.Item1;
                algorithmBenchmarkQueue = currentDeviceAlgosTuple.Item2;
                if (algorithmBenchmarkQueue.Count != 0)
                {
                    _currentAlgorithm = algorithmBenchmarkQueue.Dequeue();
                    break;
                }
                else
                {
                    _benchmarkDevicesAlgorithmQueue.RemoveAt(0);
                }
            }

            var currentConfig = _currentDevice.DeviceBenchmarkConfig;

            if (_currentDevice.DeviceGroupType == DeviceGroupType.CPU)
            {
                _currentMiner = MinersManager.GetCpuMiner(_currentDevice.Group);
            }
            else
            {
                _currentMiner = MinersManager.CreateMiner(currentConfig.DeviceGroupType, _currentAlgorithm.NiceHashID);
            }

            if (_currentMiner != null && _currentAlgorithm != null)
            {
                _benchmarkMiners.Add(_currentMiner);
                CurrentAlgoName = AlgorithmNiceHashNames.GetName(_currentAlgorithm.NiceHashID);
                // this has no effect for CPU miners
                _currentMiner.SetCDevs(new string[] { _currentDevice.UUID });

                var time = ConfigManager.Instance.GeneralConfig.BenchmarkTimeLimits
                           .GetBenchamrktime(benchmarkOptions1.PerformanceType, _currentDevice.DeviceGroupType);
                //currentConfig.TimeLimit = time;

                // dagger about 4 minutes
                var showWaitTime = _currentAlgorithm.NiceHashID == AlgorithmType.DaggerHashimoto ? 4 * 60 : time;

                dotCount = 0;
                _benchmarkingTimer.Start();

                _currentMiner.BenchmarkStart(_currentDevice, _currentAlgorithm, time, this);
                algorithmsListView1.SetSpeedStatus(_currentDevice, _currentAlgorithm.NiceHashID,
                                                   getDotsWaitString());
            }
            else
            {
                NextBenchmark();
            }
        }