예제 #1
0
        public static int ParseBenchmarkTime(List <int> defaults, MinerBenchmarkTimeSettings timeSetting, IEnumerable <MiningPair> miningPairs, BenchmarkPerformanceType benchmarkType)
        {
            var dict = new Dictionary <BenchmarkPerformanceType, int> {
                { BenchmarkPerformanceType.Quick, defaults[0] },
                { BenchmarkPerformanceType.Standard, defaults[1] },
                { BenchmarkPerformanceType.Precise, defaults[2] },
            };

            return(ParseBenchmarkTime(dict, timeSetting, miningPairs, benchmarkType));
        }
예제 #2
0
        public static int ParseBenchmarkTime(Dictionary <BenchmarkPerformanceType, int> defaults, MinerBenchmarkTimeSettings timeSetting, IEnumerable <MiningPair> miningPairs, BenchmarkPerformanceType benchmarkType)
        {
            try
            {
                if (timeSetting?.UseUserSettings ?? false)
                {
                    // TimePerAlgorithm has #1 priority
                    if (timeSetting.PerAlgorithm != null && timeSetting.PerAlgorithm.ContainsKey(benchmarkType))
                    {
                        var pairTypeTimeout = timeSetting.PerAlgorithm[benchmarkType];
                        var algorithmName   = miningPairs.FirstOrDefault()?.Algorithm?.AlgorithmName ?? "";
                        if (pairTypeTimeout != null && !string.IsNullOrEmpty(algorithmName) && pairTypeTimeout.ContainsKey(algorithmName))
                        {
                            return(pairTypeTimeout[algorithmName]);
                        }
                    }
                    // TimePerType has #2 priority
                    return(timeSetting.General[benchmarkType]);
                }
            } catch (Exception e)
            {
                Logger.Error("ParseBenchmarkTime", $"ParseBenchmarkTime failed: {e.Message}");
            }

            return(defaults[benchmarkType]);
        }
예제 #3
0
 // TODO document
 public static MinerBenchmarkTimeSettings InitMinerBenchmarkTimeSettings(string pluginRoot, MinerBenchmarkTimeSettings minerBenchmarkTimeSettings)
 {
     return(InitInternalSetting(pluginRoot, minerBenchmarkTimeSettings, "MinerBenchmarkTimeSettings.json"));
 }