public void OnBenchmarkComplete(bool success, string status)
        {
            if (!_benchmarkForm.InBenchmark)
            {
                return;
            }

            var rebenchSame = false;
            var power       = _powerHelper.Stop();

            var dualAlgo = _currentAlgorithm as DualAlgorithm;

            if (dualAlgo != null && dualAlgo.TuningEnabled)
            {
                dualAlgo.SetPowerForCurrent(power);

                if (dualAlgo.IncrementToNextEmptyIntensity())
                {
                    rebenchSame = true;
                }
            }
            else
            {
                _currentAlgorithm.PowerUsage = power;
            }

            if (!rebenchSame)
            {
                _benchmarkForm.RemoveFromStatusCheck(Device, _currentAlgorithm);
            }

            if (!success && !rebenchSame)
            {
                // add new failed list
                _benchmarkFailedAlgo.Add(_currentAlgorithm.AlgorithmName);
                _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, status);
            }
            else if (!rebenchSame)
            {
                // set status to empty string it will return speed
                _currentAlgorithm.ClearBenchmarkPending();
                _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, "");
            }

            if (rebenchSame)
            {
                _powerHelper.Start();

                if (dualAlgo != null && dualAlgo.TuningEnabled)
                {
                    var time = ConfigManager.GeneralConfig.BenchmarkTimeLimits
                               .GetBenchamrktime(_performanceType, Device.DeviceGroupType);
                    _currentMiner.BenchmarkStart(time, this);
                }
            }
            else
            {
                NextBenchmark();
            }
        }
Exemple #2
0
        public void OnBenchmarkComplete(bool success, string status)
        {
            if (!_benchmarkForm.InBenchmark)
            {
                return;
            }

            var rebenchSame = false;

            if (success && _cpuBenchmarkStatus != null && _cpuAlgos.Contains(_currentAlgorithm.NiceHashID) &&
                _currentAlgorithm.MinerBaseType == MinerBaseType.XmrStak)
            {
                _cpuBenchmarkStatus.SetNextSpeed(_currentAlgorithm.BenchmarkSpeed);
                rebenchSame = _cpuBenchmarkStatus.HasTest();
                _currentAlgorithm.LessThreads = _cpuBenchmarkStatus.LessTreads;
                if (rebenchSame == false)
                {
                    _cpuBenchmarkStatus.FindFastest();
                    _currentAlgorithm.BenchmarkSpeed = _cpuBenchmarkStatus.GetBestSpeed();
                    _currentAlgorithm.LessThreads    = _cpuBenchmarkStatus.GetLessThreads();
                }
            }

            if (_claymoreZcashStatus != null && _currentAlgorithm.MinerBaseType == MinerBaseType.Claymore &&
                _currentAlgorithm.NiceHashID == AlgorithmType.Equihash)
            {
                if (_claymoreZcashStatus.HasTest())
                {
                    _currentMiner = MinerFactory.CreateMiner(Device, _currentAlgorithm);
                    rebenchSame   = true;
                    //System.Threading.Thread.Sleep(1000*60*5);
                    _claymoreZcashStatus.SetSpeed(_currentAlgorithm.BenchmarkSpeed);
                    _claymoreZcashStatus.SetNext();
                    _currentAlgorithm.ExtraLaunchParameters = _claymoreZcashStatus.GetTestExtraParams();
                    Helpers.ConsolePrint("ClaymoreAMD_Equihash", _currentAlgorithm.ExtraLaunchParameters);
                    _currentMiner.InitBenchmarkSetup(new MiningPair(Device, _currentAlgorithm));
                }

                if (_claymoreZcashStatus.HasTest() == false)
                {
                    rebenchSame = false;
                    // set fastest mode
                    _currentAlgorithm.BenchmarkSpeed        = _claymoreZcashStatus.GetFastestTime();
                    _currentAlgorithm.ExtraLaunchParameters = _claymoreZcashStatus.GetFastestExtraParams();
                }
            }

            var power = _powerHelper.Stop();

            var dualAlgo = _currentAlgorithm as DualAlgorithm;

            if (dualAlgo != null && dualAlgo.TuningEnabled)
            {
                dualAlgo.SetPowerForCurrent(power);

                if (dualAlgo.IncrementToNextEmptyIntensity())
                {
                    rebenchSame = true;
                }
            }
            else
            {
                _currentAlgorithm.PowerUsage = power;
            }

            if (!rebenchSame)
            {
                _benchmarkForm.RemoveFromStatusCheck(Device, _currentAlgorithm);
            }

            if (!success && !rebenchSame)
            {
                // add new failed list
                _benchmarkFailedAlgo.Add(_currentAlgorithm.AlgorithmName);
                _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, status);
            }
            else if (!rebenchSame)
            {
                // set status to empty string it will return speed
                _currentAlgorithm.ClearBenchmarkPending();
                _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, "");
            }

            if (rebenchSame)
            {
                _powerHelper.Start();

                if (_cpuBenchmarkStatus != null)
                {
                    _currentMiner.BenchmarkStart(_cpuBenchmarkStatus.Time, this);
                }
                else if (_claymoreZcashStatus != null)
                {
                    _currentMiner.BenchmarkStart(_claymoreZcashStatus.Time, this);
                }
                else if (dualAlgo != null && dualAlgo.TuningEnabled)
                {
                    var time = ConfigManager.GeneralConfig.BenchmarkTimeLimits
                               .GetBenchamrktime(_performanceType, Device.DeviceGroupType);
                    _currentMiner.BenchmarkStart(time, this);
                }
            }
            else
            {
                NextBenchmark();
            }
        }
        private async Task BenchmarkAlgorithm(/*Algorithm algo*/)
        {
            // fix naming
            var _currentMiner = MinerFactory.CreateMiner(Device, _currentAlgorithm);

            if (_currentMiner == null)
            {
                return;
            }
            // well lets just assume it is not null
            // actual benchmarking scope?
            {
                _benchmarkForm.AddToStatusCheck(Device, _currentAlgorithm);
                // TODO add the multiple benchmark loop


                _currentMiner.InitBenchmarkSetup(new MiningPair(Device, _currentAlgorithm));
                var time = ConfigManager.GeneralConfig.BenchmarkTimeLimits
                           .GetBenchamrktime(_performanceType, Device.DeviceGroupType);
                ////currentConfig.TimeLimit = time;
                //if (_cpuBenchmarkStatus != null) _cpuBenchmarkStatus.Time = time;
                //if (_claymoreZcashStatus != null) _claymoreZcashStatus.Time = time;

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



                var benchTaskResult = _currentMiner.BenchmarkStartAsync(time, _stopBenchmark.Token);
                _powerHelper.Start();
                var result      = await benchTaskResult;
                var power       = _powerHelper.Stop();
                var rebenchSame = false; // TODO get rid of this, but keep for DualAlgorithm's for now

                var dualAlgo = _currentAlgorithm as DualAlgorithm;
                if (dualAlgo != null && dualAlgo.TuningEnabled)
                {
                    dualAlgo.SetPowerForCurrent(power);

                    if (dualAlgo.IncrementToNextEmptyIntensity())
                    {
                        rebenchSame = true;
                    }
                }
                else
                {
                    _currentAlgorithm.PowerUsage = power;
                }

                if (!rebenchSame)
                {
                    _benchmarkForm.RemoveFromStatusCheck(Device, _currentAlgorithm);
                }

                if (!result.Success && !rebenchSame)
                {
                    // add new failed list
                    _benchmarkFailedAlgo.Add(_currentAlgorithm.AlgorithmName);
                    _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, result.Status);
                }
                else if (!rebenchSame)
                {
                    // set status to empty string it will return speed
                    _currentAlgorithm.ClearBenchmarkPending();
                    _benchmarkForm.SetCurrentStatus(Device, _currentAlgorithm, "");
                }
            }
        }