diff --git a/LatestBuild/nhmlffLatest.zip b/LatestBuild/nhmlffLatest.zip index bad9eaca6..998803430 100644 Binary files a/LatestBuild/nhmlffLatest.zip and b/LatestBuild/nhmlffLatest.zip differ diff --git a/NiceHashMiner/Algorithms/Algorithm.cs b/NiceHashMiner/Algorithms/Algorithm.cs index 2ee426626..8d0fc7a08 100644 --- a/NiceHashMiner/Algorithms/Algorithm.cs +++ b/NiceHashMiner/Algorithms/Algorithm.cs @@ -50,6 +50,7 @@ public class Algorithm /// Hashrate in H/s set by benchmark or user /// public virtual double BenchmarkSpeed { get; set; } + public virtual double BenchmarkSecondarySpeed { get; set; } /// /// Gets the averaged speed for this algorithm in H/s /// When multiple devices of the same model are used, this will be set to their averaged hashrate @@ -182,19 +183,56 @@ public string CurPayingRatio return ratio; } } - + public string CurSecondPayingRatio + { + get + { + var ratio = International.GetText("BenchmarkRatioRateN_A"); + if (NiceHashID == AlgorithmType.Autolykos && SecondaryNiceHashID == AlgorithmType.DaggerHashimoto && NHSmaData.TryGetPaying(SecondaryNiceHashID, out var paying))//ZIL + { + ratio = (paying / 30).ToString("F8"); + } + else if (NHSmaData.TryGetPaying(SecondaryNiceHashID, out var paying2)) + { + ratio = paying2.ToString("F8"); + } + return ratio; + } + } public virtual string CurPayingRate { get { + /* var rate = International.GetText("BenchmarkRatioRateN_A"); - + if (BenchmarkSpeed > 0 && NHSmaData.TryGetPaying(NiceHashID, out var paying)) { var payingRate = BenchmarkSpeed * paying * Mult; rate = payingRate.ToString("F8"); } - + */ + var rate = International.GetText("BenchmarkRatioRateN_A"); + var payingRate = 0.0d; + + if (BenchmarkSpeed > 0 && NHSmaData.TryGetPaying(NiceHashID, out var paying)) + { + payingRate += BenchmarkSpeed * paying * Mult; + rate = payingRate.ToString("F8"); + } + + if (NiceHashID == AlgorithmType.Autolykos && SecondaryNiceHashID == AlgorithmType.DaggerHashimoto && NHSmaData.TryGetPaying(SecondaryNiceHashID, out var secPaying2))//ZIL + { + + payingRate += BenchmarkSecondarySpeed * (secPaying2 / 30) * Mult; + rate = payingRate.ToString("F8"); + } + else if (BenchmarkSecondarySpeed > 0 && NHSmaData.TryGetPaying(SecondaryNiceHashID, out var secPaying)) + { + payingRate += BenchmarkSecondarySpeed * secPaying * Mult; + rate = payingRate.ToString("F8"); + } + return rate; } set @@ -260,6 +298,19 @@ public string BenchmarkSpeedString() } return International.GetText("BenchmarkSpeedStringNone"); } + public string SecondaryBenchmarkSpeedString() + { + if (BenchmarkSecondarySpeed > 0) + { + return Helpers.FormatDualSpeedOutput(BenchmarkSecondarySpeed, 0, DualNiceHashID); + } + //if (!IsPendingString() && !string.IsNullOrEmpty(BenchmarkStatus)) + if (!string.IsNullOrEmpty(BenchmarkStatus) && BenchmarkActive) + { + return BenchmarkStatus; + } + return International.GetText("BenchmarkSpeedStringNone"); + } #endregion diff --git a/NiceHashMiner/Algorithms/DualAlgorithm.cs b/NiceHashMiner/Algorithms/DualAlgorithm.cs index 4b3650f42..2f705762e 100644 --- a/NiceHashMiner/Algorithms/DualAlgorithm.cs +++ b/NiceHashMiner/Algorithms/DualAlgorithm.cs @@ -151,6 +151,8 @@ public SortedSet AllIntensities /// Primary hashrate in H/s set by benchmark or user /// If tuning is enabled, returns the hashrate from the most profitable intensity /// + /// + /* public override double BenchmarkSpeed { get @@ -172,12 +174,13 @@ public override double BenchmarkSpeed return base.BenchmarkSpeed; } } - + */ private double _secondaryBenchmarkSpeed; /// /// Secondary hashrate in H/s set by benchmark or user /// If tuning is enabled, returns the hashrate from the most profitable intensity /// + /* public double SecondaryBenchmarkSpeed { get @@ -200,6 +203,7 @@ public double SecondaryBenchmarkSpeed } set => _secondaryBenchmarkSpeed = value; } + */ /// /// Gets the secondary averaged speed for this algorithm in H/s @@ -210,6 +214,7 @@ public double SecondaryBenchmarkSpeed /// /// Indicates whether this algorithm requires a benchmark /// + /* public override bool BenchmarkNeeded { get @@ -229,7 +234,7 @@ public override bool BenchmarkNeeded return false; } } - + */ #endregion #region Power Switching @@ -274,7 +279,7 @@ public DualAlgorithm(MinerBaseType minerBaseType, AlgorithmType niceHashID, Algo SecondaryAlgorithmName = AlgorithmNiceHashNames.GetName(secondaryNiceHashID); AlgorithmStringID = MinerBaseTypeName + "_" + AlgorithmName; DualAlgorithmNameCustom = _DualAlgorithmNameCustom; - SecondaryBenchmarkSpeed = 0.0d; + //SecondaryBenchmarkSpeed = 0.0d; IntensitySpeeds = new Dictionary(); SecondaryIntensitySpeeds = new Dictionary(); @@ -282,7 +287,7 @@ public DualAlgorithm(MinerBaseType minerBaseType, AlgorithmType niceHashID, Algo } #region Benchmark info - + /* public override string CurPayingRate { get @@ -311,7 +316,8 @@ public override string CurPayingRate return rate; } } - + */ + /* public string SecondaryCurPayingRatio { get @@ -328,20 +334,8 @@ public string SecondaryCurPayingRatio return ratio; } } - public string SecondaryCurPayingRatioZIL - { - get - { - var ratio = International.GetText("BenchmarkRatioRateN_A"); - if (NHSmaData.TryGetPaying(SecondaryNiceHashID, out var paying)) - { - ratio = (paying / 30).ToString("F8"); - } - - return ratio; - } - } - + */ + /* public string SecondaryBenchmarkSpeedString() { const string dcriStatus = " (dcri:{0})"; @@ -358,9 +352,9 @@ public string SecondaryBenchmarkSpeedString() return International.GetText("BenchmarkSpeedStringNone"); } - + */ #endregion - + /* public override void UpdateCurProfit(Dictionary profits) { base.UpdateCurProfit(profits); @@ -383,7 +377,7 @@ public override void UpdateCurProfit(Dictionary profits) SubtractPowerFromProfit(); } - + */ #region ClaymoreDual Tuning public void SetIntensitySpeedsForCurrent(double speed, double secondarySpeed) diff --git a/NiceHashMiner/Configs/Data/AlgorithmConfig.cs b/NiceHashMiner/Configs/Data/AlgorithmConfig.cs index a681b70fd..369f497a7 100644 --- a/NiceHashMiner/Configs/Data/AlgorithmConfig.cs +++ b/NiceHashMiner/Configs/Data/AlgorithmConfig.cs @@ -10,9 +10,9 @@ public class AlgorithmConfig public AlgorithmType NiceHashID = AlgorithmType.NONE; public AlgorithmType SecondaryNiceHashID = AlgorithmType.NONE; public MinerBaseType MinerBaseType = MinerBaseType.NONE; - public string AlgorithmNameCustom = ""; // probably not needed + public string AlgorithmNameCustom = ""; public double BenchmarkSpeed = 0; - public double SecondaryBenchmarkSpeed = 0; + public double BenchmarkSecondarySpeed = 0; public string ExtraLaunchParameters = ""; public bool Enabled = true; public bool Hidden = false; diff --git a/NiceHashMiner/Configs/Data/GeneralConfig.cs b/NiceHashMiner/Configs/Data/GeneralConfig.cs index a8218e7d4..f763b7fed 100644 --- a/NiceHashMiner/Configs/Data/GeneralConfig.cs +++ b/NiceHashMiner/Configs/Data/GeneralConfig.cs @@ -23,6 +23,7 @@ public class GeneralConfig public int DaggerHashimoto1070MaxEpoch = 371; public LanguageType Language = LanguageType.En; public string DisplayCurrency = "USD"; + public bool Show_displayConected = false; public bool Show_current_actual_profitability = true; public bool DivertRun = true; public bool ShowUptime = true; @@ -229,6 +230,7 @@ public void SetDefaults() ProgramMonitoring = true; AutoStartMining = false; AutoStartMiningDelay = 0; + Show_displayConected = false; //LessThreads = 0; DivertRun = true; HideMiningWindows = false; diff --git a/NiceHashMiner/Devices/Algorithms/DefaultAlgorithms.cs b/NiceHashMiner/Devices/Algorithms/DefaultAlgorithms.cs index 51b7b4af5..af1cd7608 100644 --- a/NiceHashMiner/Devices/Algorithms/DefaultAlgorithms.cs +++ b/NiceHashMiner/Devices/Algorithms/DefaultAlgorithms.cs @@ -56,10 +56,6 @@ public static class DefaultAlgorithms new List() { new Algorithm(MinerBaseType.Nanominer, AlgorithmType.DaggerHashimoto, "DaggerHashimoto") - { - ExtraLaunchParameters = "" - }, - new DualAlgorithm(MinerBaseType.Nanominer, AlgorithmType.Autolykos, AlgorithmType.DaggerHashimoto, "Autolykos+Zilliqa") { ExtraLaunchParameters = "memTweak=1" } @@ -213,6 +209,20 @@ public static class DefaultAlgorithms } }, + { + MinerBaseType.Nanominer, + new List() + { + new Algorithm(MinerBaseType.Nanominer, AlgorithmType.Autolykos, "Autolykos") + { + ExtraLaunchParameters = "memTweak=1" + }, + new DualAlgorithm(MinerBaseType.Nanominer, AlgorithmType.Autolykos, AlgorithmType.DaggerHashimoto, "Autolykos+Zilliqa") + { + ExtraLaunchParameters = "memTweak=1" + } + } + }, }.ConcatDictList(All, Gpu); #endregion @@ -247,6 +257,10 @@ public static class DefaultAlgorithms { ExtraLaunchParameters = "" }, + new Algorithm(MinerBaseType.trex, AlgorithmType.Autolykos, "Autolykos") + { + ExtraLaunchParameters = "--mt 1" + } } }, diff --git a/NiceHashMiner/Devices/AmdGpuDevice.cs b/NiceHashMiner/Devices/AmdGpuDevice.cs index 04832d0dc..90da35a91 100644 --- a/NiceHashMiner/Devices/AmdGpuDevice.cs +++ b/NiceHashMiner/Devices/AmdGpuDevice.cs @@ -15,6 +15,7 @@ public class AmdGpuDevice public string UUID; // init this with the ADL, use PCI_VEN & DEV IDs //public ulong DeviceGlobalMemory => _openClSubset._CL_DEVICE_GLOBAL_MEM_SIZE; public ulong DeviceGlobalMemory; + public bool MonitorConnected; //public bool UseOptimizedVersion { get; private set; } private readonly OpenCLDevice _openClSubset = new OpenCLDevice(); diff --git a/NiceHashMiner/Devices/ComputeDevice/AmdComputeDevice.cs b/NiceHashMiner/Devices/ComputeDevice/AmdComputeDevice.cs index 28f7fef54..a400d30b4 100644 --- a/NiceHashMiner/Devices/ComputeDevice/AmdComputeDevice.cs +++ b/NiceHashMiner/Devices/ComputeDevice/AmdComputeDevice.cs @@ -320,7 +320,7 @@ public AmdComputeDevice(AmdGpuDevice amdDevice, int gpuCount, bool isDetectionFa amdDevice.IsEtherumCapable(), DeviceType.AMD, string.Format(International.GetText("ComputeDevice_Short_Name_AMD_GPU"), gpuCount), - amdDevice.DeviceGlobalMemory, amdDevice.AMDManufacturer) + amdDevice.DeviceGlobalMemory, amdDevice.AMDManufacturer, amdDevice.MonitorConnected) { Uuid = isDetectionFallback ? GetUuid(ID, GroupNames.GetGroupName(DeviceGroupType, ID), Name, DeviceGroupType) diff --git a/NiceHashMiner/Devices/ComputeDevice/CPUComputeDevice.cs b/NiceHashMiner/Devices/ComputeDevice/CPUComputeDevice.cs index 3fdb88ec4..43734b163 100644 --- a/NiceHashMiner/Devices/ComputeDevice/CPUComputeDevice.cs +++ b/NiceHashMiner/Devices/ComputeDevice/CPUComputeDevice.cs @@ -127,7 +127,7 @@ public override double PowerUsage } } - public CpuComputeDevice(int id, string group, string name, int threads, ulong affinityMask, int cpuCount) + public CpuComputeDevice(int id, string group, string name, int threads, ulong affinityMask, int cpuCount, bool monitorconnected = false) : base(id, name, true, @@ -135,7 +135,7 @@ public CpuComputeDevice(int id, string group, string name, int threads, ulong af false, DeviceType.CPU, string.Format(International.GetText("ComputeDevice_Short_Name_CPU"), cpuCount), - 0, "") + 0, "", monitorconnected) { group = ""; Threads = threads; diff --git a/NiceHashMiner/Devices/ComputeDevice/ComputeDevice.cs b/NiceHashMiner/Devices/ComputeDevice/ComputeDevice.cs index 042fe37a2..04ea4df92 100644 --- a/NiceHashMiner/Devices/ComputeDevice/ComputeDevice.cs +++ b/NiceHashMiner/Devices/ComputeDevice/ComputeDevice.cs @@ -56,6 +56,7 @@ public class ComputeDevice // GPU extras public ulong GpuRam; public bool IsEtherumCapale; + public bool MonitorConnected; /* public static readonly ulong Memory3Gb = 3221225472; public static readonly ulong Memory4Gb = 4293918720; @@ -312,7 +313,7 @@ private static int GetVirtualCoresCount() //******************************************************************************************************************** // Ambiguous constructor protected ComputeDevice(int id, string name, bool enabled, DeviceGroupType group, bool ethereumCapable, - DeviceType type, string nameCount, ulong gpuRam, string manufacturer) + DeviceType type, string nameCount, ulong gpuRam, string manufacturer, bool monitorconnected) { ID = id; Name = name; @@ -323,6 +324,7 @@ private static int GetVirtualCoresCount() NameCount = nameCount; GpuRam = gpuRam; Manufacturer = manufacturer; + MonitorConnected = monitorconnected; } // Fake dev @@ -410,6 +412,7 @@ public void CopyBenchmarkSettingsFrom(ComputeDevice copyBenchCDev) setAlgo.Enabled = copyFromAlgo.Enabled; setAlgo.BenchmarkSpeed = copyFromAlgo.BenchmarkSpeed; + setAlgo.BenchmarkSecondarySpeed = copyFromAlgo.BenchmarkSecondarySpeed; setAlgo.ExtraLaunchParameters = copyFromAlgo.ExtraLaunchParameters; setAlgo.LessThreads = copyFromAlgo.LessThreads; setAlgo.PowerUsage = copyFromAlgo.PowerUsage; @@ -417,7 +420,8 @@ public void CopyBenchmarkSettingsFrom(ComputeDevice copyBenchCDev) if (setAlgo is DualAlgorithm dualSA && copyFromAlgo is DualAlgorithm dualCFA) { - dualSA.SecondaryBenchmarkSpeed = dualCFA.SecondaryBenchmarkSpeed; + setAlgo.BenchmarkSecondarySpeed = copyFromAlgo.BenchmarkSecondarySpeed; + //dualSA.SecondaryBenchmarkSpeed = dualCFA.SecondaryBenchmarkSpeed; } } } @@ -465,27 +469,16 @@ public void SetAlgorithmDeviceConfig(DeviceBenchmarkConfig config) if (setAlgo != null) { setAlgo.BenchmarkSpeed = conf.BenchmarkSpeed; + setAlgo.BenchmarkSecondarySpeed = conf.BenchmarkSecondarySpeed; setAlgo.ExtraLaunchParameters = conf.ExtraLaunchParameters; setAlgo.Enabled = conf.Enabled; - //setAlgo.Hidden = conf.Hidden; - if (conf.Hidden) - { - // setAlgo.Enabled = false; - } + setAlgo.LessThreads = conf.LessThreads; setAlgo.PowerUsage = conf.PowerUsage; - /* - setAlgo.gpu_clock = conf.gpu_clock; - setAlgo.mem_clock = conf.mem_clock; - setAlgo.gpu_voltage = conf.gpu_voltage; - setAlgo.power_limit = conf.power_limit; - setAlgo.fan = conf.fan; - setAlgo.fan_flag = conf.fan_flag; - setAlgo.thermal_limit = conf.thermal_limit; - */ + if (setAlgo is DualAlgorithm dualSA) { - dualSA.SecondaryBenchmarkSpeed = conf.SecondaryBenchmarkSpeed; + //dualSA.SecondaryBenchmarkSpeed = conf.SecondaryBenchmarkSpeed; var dualConf = config.DualAlgorithmSettings?.Find(a => a.SecondaryNiceHashID == dualSA.SecondaryNiceHashID); if (dualConf != null) @@ -538,58 +531,14 @@ public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() MinerBaseType = algo.MinerBaseType, AlgorithmNameCustom = algo.AlgorithmNameCustom, BenchmarkSpeed = algo.BenchmarkSpeed, + BenchmarkSecondarySpeed = algo.BenchmarkSecondarySpeed, ExtraLaunchParameters = algo.ExtraLaunchParameters, Enabled = algo.Enabled, Hidden = algo.Hidden, LessThreads = algo.LessThreads, PowerUsage = algo.PowerUsage - /* - gpu_clock = algo.gpu_clock, - mem_clock = algo.mem_clock, - gpu_voltage = algo.gpu_voltage, - power_limit = algo.power_limit, - fan = algo.fan, - fan_flag = algo.fan_flag, - thermal_limit = algo.thermal_limit - */ }; - /* - var conf = new AlgorithmConfig(); - conf.Name = algo.AlgorithmStringID; - conf.NiceHashID = algo.NiceHashID; - conf.MinerBaseType = algo.MinerBaseType; - conf.MinerName = algo.MinerName; - conf.BenchmarkSpeed = algo.BenchmarkSpeed; - conf.ExtraLaunchParameters = algo.ExtraLaunchParameters; - conf.Enabled = algo.Enabled; - conf.Hidden = algo.Hidden; - conf.LessThreads = algo.LessThreads; - conf.PowerUsage = algo.PowerUsage; - conf.gpu_clock = algo.gpu_clock; - conf.mem_clock = algo.mem_clock; - conf.gpu_voltage = algo.gpu_voltage; - conf.power_limit = algo.power_limit; - //fan = algo.fan, - conf.fan_flag = algo.fan_flag; - conf.thermal_limit = algo.thermal_limit; - */ - //Helpers.ConsolePrint("***************", "MSIAfterburner.Initialized?" + MSIAfterburner.Initialized); - if (MSIAfterburner.Initialized) - { - //Helpers.ConsolePrint("***************", "MSIAfterburner.Initialized"); - /* - MSIAfterburner.ABData _abdata = MSIAfterburner.GetDeviceData(BusID); - //Helpers.ConsolePrint("***************", "conf.fan: " + conf.fan.ToString() + " _abdata.FanSpeedMin: " + _abdata.FanSpeedMin.ToString()); - if (conf.gpu_clock < _abdata.CoreClockBoostMin || conf.gpu_clock > _abdata.CoreClockBoostMax) conf.gpu_clock = _abdata.CoreClockBoostDef; - if (conf.mem_clock < _abdata.MemoryClockBoostMin || conf.mem_clock > _abdata.MemoryClockBoostMax) conf.mem_clock = _abdata.MemoryClockBoostDef; - if (conf.gpu_voltage < _abdata.CoreVoltageBoostMin || conf.gpu_voltage > _abdata.CoreVoltageBoostMax) conf.gpu_voltage = _abdata.CoreVoltageBoostDef; - if (conf.power_limit < _abdata.PowerLimitMin || conf.power_limit > _abdata.PowerLimitMax) conf.power_limit = _abdata.PowerLimitDef; - if (conf.fan < _abdata.FanSpeedMin || conf.fan > _abdata.FanSpeedMax) algo.fan = _abdata.FanSpeedDef; - if (conf.thermal_limit < _abdata.ThermalLimitMin || conf.thermal_limit > _abdata.ThermalLimitMax) algo.thermal_limit = _abdata.ThermalLimitDef; - */ - } - //Helpers.ConsolePrint("***************", "conf.fan: " + conf.fan.ToString() + " algo.fan: " + algo.fan.ToString()); - // insert + if (!conf.Hidden) { ret.AlgorithmSettings.Add(conf); @@ -597,7 +546,8 @@ public DeviceBenchmarkConfig GetAlgorithmDeviceConfig() if (algo is DualAlgorithm dualAlgo) { conf.SecondaryNiceHashID = dualAlgo.SecondaryNiceHashID; - conf.SecondaryBenchmarkSpeed = dualAlgo.SecondaryBenchmarkSpeed; + conf.BenchmarkSecondarySpeed = algo.BenchmarkSecondarySpeed; + //conf.SecondaryBenchmarkSpeed = dualAlgo.SecondaryBenchmarkSpeed; DualAlgorithmConfig dualConf = new DualAlgorithmConfig { diff --git a/NiceHashMiner/Devices/ComputeDevice/CudaComputeDevice.cs b/NiceHashMiner/Devices/ComputeDevice/CudaComputeDevice.cs index 31aa84288..71314f785 100644 --- a/NiceHashMiner/Devices/ComputeDevice/CudaComputeDevice.cs +++ b/NiceHashMiner/Devices/ComputeDevice/CudaComputeDevice.cs @@ -286,7 +286,7 @@ public override double PowerUsage cudaDevice.IsEtherumCapable(), DeviceType.NVIDIA, string.Format(International.GetText("ComputeDevice_Short_Name_NVIDIA_GPU"), gpuCount), - cudaDevice.DeviceGlobalMemory, cudaDevice.CUDAManufacturer) + cudaDevice.DeviceGlobalMemory, cudaDevice.CUDAManufacturer, cudaDevice.MonitorConnected) { BusID = cudaDevice.pciBusID; SMMajor = cudaDevice.SM_major; diff --git a/NiceHashMiner/Devices/ComputeDeviceManager.cs b/NiceHashMiner/Devices/ComputeDeviceManager.cs index 7216f6cca..45cf99d6f 100644 --- a/NiceHashMiner/Devices/ComputeDeviceManager.cs +++ b/NiceHashMiner/Devices/ComputeDeviceManager.cs @@ -757,6 +757,7 @@ public static string GetManufacturer(string man) Manufacturer = man.Substring(man.Length - 4), PnpDeviceID = SafeGetProperty(manObj, "PNPDeviceID"), DeviceID = SafeGetProperty(manObj, "DeviceID"), + CurrentRefreshRate = SafeGetProperty(manObj, "CurrentRefreshRate"), DriverVersion = SafeGetProperty(manObj, "DriverVersion"), Status = SafeGetProperty(manObj, "Status"), InfSection = SafeGetProperty(manObj, "InfSection"), @@ -768,6 +769,7 @@ public static string GetManufacturer(string man) stringBuilder.AppendLine($"\t\tDescription {vidController.Description}"); stringBuilder.AppendLine($"\t\tManufacturer {GetManufacturer(vidController.Manufacturer)} ({vidController.Manufacturer})"); stringBuilder.AppendLine($"\t\tPNPDeviceID {vidController.PnpDeviceID}"); + stringBuilder.AppendLine($"\t\tCurrentRefreshRate {vidController.CurrentRefreshRate}"); stringBuilder.AppendLine($"\t\tDeviceID {vidController.DeviceID}"); stringBuilder.AppendLine($"\t\tDriverVersion {vidController.DriverVersion}"); stringBuilder.AppendLine($"\t\tStatus {vidController.Status}"); @@ -878,7 +880,7 @@ public static void QueryCpus() { Available.Devices.Add( new CpuComputeDevice(0, "CPU0", CpuID.GetCpuName().Trim(), threadsPerCpu, 0, - ++CpuCount) + ++CpuCount, false) ); } else if (Available.CpusCount > 1) @@ -1016,6 +1018,7 @@ public static void QueryCudaDevices() } string Manufacturer = (cudaDev.pciSubSystemId).ToString("X16").Substring((cudaDev.pciSubSystemId).ToString("X16").Length - 4); cudaDev.CUDAManufacturer = ComputeDevice.GetManufacturer(Manufacturer); + if (cudaDev.HasMonitorConnected > 0) cudaDev.MonitorConnected = true; //bool isOverSM6 = cudaDev.SM_major > 6; var skip = isUnderSM21; var skipOrAdd = skip ? "SKIPED" : "ADDED"; diff --git a/NiceHashMiner/Devices/CudaDevice.cs b/NiceHashMiner/Devices/CudaDevice.cs index 48a40ea82..df1629215 100644 --- a/NiceHashMiner/Devices/CudaDevice.cs +++ b/NiceHashMiner/Devices/CudaDevice.cs @@ -19,6 +19,7 @@ public class CudaDevices2 public string DeviceName; public string CUDAManufacturer; public int HasMonitorConnected; + public bool MonitorConnected; public int SMX; public int SM_major; public int SM_minor; diff --git a/NiceHashMiner/Devices/MSIAfterburner.cs b/NiceHashMiner/Devices/MSIAfterburner.cs index 746d2d3a6..7bab2ef14 100644 --- a/NiceHashMiner/Devices/MSIAfterburner.cs +++ b/NiceHashMiner/Devices/MSIAfterburner.cs @@ -183,7 +183,14 @@ public static bool MSIAfterburnerRUN(bool forceRun = false) if ((int)wdwIntPtr > 1) { - Thread.Sleep(3000);//обязательная пауза + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Starting") + " 25%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Starting") + " 50%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Starting") + " 75%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Starting") + " 100%"); break; } repeats++; @@ -209,17 +216,25 @@ public static bool MSIAfterburnerRUN(bool forceRun = false) //GetWindowPlacement(wdwIntPtr, ref placement); //ShowWindow(wdwIntPtr, ShowWindowEnum.ForceMinimized); } - Thread.Sleep(3000);//обязательная пауза + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Checking") + " 25%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Checking") + " 50%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Checking") + " 75%"); + Thread.Sleep(1000);//обязательная пауза + waiting.SetText("", International.GetText("MSIAB_Checking") + " 100%"); P.Exited += new EventHandler(MSIABprocessExited); P.EnableRaisingEvents = true; break; } repeats++; Thread.Sleep(1000); - } while (repeats < 5); + } while (repeats < 10); if (!meminit) { + Thread.Sleep(200); if (waiting != null) waiting.CloseWaitingBox(); MSIAB_starting = false; return false; @@ -236,7 +251,11 @@ public static bool MSIAfterburnerRUN(bool forceRun = false) return false; } } - if (waiting != null) waiting.CloseWaitingBox(); + if (waiting != null) + { + Thread.Sleep(100); + waiting.CloseWaitingBox(); + } } MSIAB_starting = false; return true; diff --git a/NiceHashMiner/Devices/Querying/AmdQuery.cs b/NiceHashMiner/Devices/Querying/AmdQuery.cs index 20cd915af..c25bec6e4 100644 --- a/NiceHashMiner/Devices/Querying/AmdQuery.cs +++ b/NiceHashMiner/Devices/Querying/AmdQuery.cs @@ -204,21 +204,23 @@ private List AmdDeviceCreationPrimary(List amdDevice foreach (var manObj in moc) { ulong.TryParse(SafeGetProperty(manObj, "AdapterRAM"), out var memTmp); + int.TryParse(SafeGetProperty(manObj, "CurrentRefreshRate"), out var _monitorConnected); PnpDeviceID = SafeGetProperty(manObj, "PNPDeviceID"); gpumem = memTmp + gpumemadd‬; - } - if (PnpDeviceID.Split('&')[4].Equals(newAmdDev.UUID.Split('_')[4])) - { - if (newAmdDev.DeviceGlobalMemory < gpumem) + + if (PnpDeviceID.Split('&')[4].Equals(newAmdDev.UUID.Split('_')[4])) { - Helpers.ConsolePrint("AMDQUERY", deviceName + " GPU mem size is not equal: " + newAmdDev.DeviceGlobalMemory.ToString() + " < " + gpumem.ToString()); - newAmdDev.DeviceGlobalMemory = gpumem; - dev._CL_DEVICE_GLOBAL_MEM_SIZE = gpumem; + if (_monitorConnected > 0) newAmdDev.MonitorConnected = true; + if (newAmdDev.DeviceGlobalMemory < gpumem) + { + Helpers.ConsolePrint("AMDQUERY", deviceName + " GPU mem size is not equal: " + newAmdDev.DeviceGlobalMemory.ToString() + " < " + gpumem.ToString()); + newAmdDev.DeviceGlobalMemory = gpumem; + dev._CL_DEVICE_GLOBAL_MEM_SIZE = gpumem; + } } } - //************* var isDisabledGroup = ConfigManager.GeneralConfig.DeviceDetection .DisableDetectionAMD; @@ -244,6 +246,7 @@ private List AmdDeviceCreationPrimary(List amdDevice stringBuilder.AppendLine($"\t{skipOrAdd} device{isDisabledGroupStr}:"); stringBuilder.AppendLine($"\t\tNAME: {newAmdDev.DeviceName}"); stringBuilder.AppendLine($"\t\tCODE_NAME: {newAmdDev.Codename}"); + stringBuilder.AppendLine($"\t\tMonitor connected: {newAmdDev.MonitorConnected}"); stringBuilder.AppendLine($"\t\tManufacturer: {newAmdDev.AMDManufacturer}"); stringBuilder.AppendLine($"\t\tUUID: {newAmdDev.UUID}"); stringBuilder.AppendLine($"\t\tNewUUID: {newAmdDev.NewUUID}"); diff --git a/NiceHashMiner/Devices/Querying/VideoControllerData.cs b/NiceHashMiner/Devices/Querying/VideoControllerData.cs index 4d0db1f3b..81dcf4dc8 100644 --- a/NiceHashMiner/Devices/Querying/VideoControllerData.cs +++ b/NiceHashMiner/Devices/Querying/VideoControllerData.cs @@ -16,6 +16,7 @@ public class VideoControllerData public string Status { get; set; } public string InfSection { get; set; } // get arhitecture public ulong AdapterRam { get; set; } + public string CurrentRefreshRate { get; set; } public string Manufacturer { get; internal set; } } } diff --git a/NiceHashMiner/Forms/Components/AlgorithmSettingsControl.cs b/NiceHashMiner/Forms/Components/AlgorithmSettingsControl.cs index b5c99254b..6d61b12aa 100644 --- a/NiceHashMiner/Forms/Components/AlgorithmSettingsControl.cs +++ b/NiceHashMiner/Forms/Components/AlgorithmSettingsControl.cs @@ -120,7 +120,8 @@ public void SetCurrentlySelected(ListViewItem lvi, ComputeDevice computeDevice) richTextBoxExtraLaunchParameters.Text = ParseStringDefault(algorithm.ExtraLaunchParameters); if (algorithm is DualAlgorithm dualAlgo) { - secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(dualAlgo.SecondaryBenchmarkSpeed); + //secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(dualAlgo.SecondaryBenchmarkSpeed); + secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(algorithm.BenchmarkSecondarySpeed); secondaryFieldBoxBenchmarkSpeed.Enabled = true; } else @@ -153,7 +154,8 @@ public void ChangeSpeed(ListViewItem lvi) field_PowerUsage.EntryText = ParseDoubleDefault(Math.Round(algorithm.PowerUsage,0)); if (algorithm is DualAlgorithm dualAlgo) { - secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(dualAlgo.SecondaryBenchmarkSpeed); + //secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(dualAlgo.SecondaryBenchmarkSpeed); + secondaryFieldBoxBenchmarkSpeed.EntryText = ParseDoubleDefault(algorithm.BenchmarkSecondarySpeed); } else { @@ -195,7 +197,8 @@ private void SecondaryTextChangedBenchmarkSpeed(object sender, EventArgs e) if (double.TryParse(secondaryFieldBoxBenchmarkSpeed.EntryText, out var secondaryValue) && _currentlySelectedAlgorithm is DualAlgorithm dualAlgo) { - dualAlgo.SecondaryBenchmarkSpeed = secondaryValue; + //dualAlgo.SecondaryBenchmarkSpeed = secondaryValue; + _currentlySelectedAlgorithm.BenchmarkSecondarySpeed = secondaryValue; } UpdateSpeedText(); } @@ -203,7 +206,8 @@ private void SecondaryTextChangedBenchmarkSpeed(object sender, EventArgs e) private void UpdateSpeedText() { var speed = _currentlySelectedAlgorithm.BenchmarkSpeed; - var secondarySpeed = (_currentlySelectedAlgorithm is DualAlgorithm dualAlgo) ? dualAlgo.SecondaryBenchmarkSpeed : 0; + //var secondarySpeed = (_currentlySelectedAlgorithm is DualAlgorithm dualAlgo) ? dualAlgo.SecondaryBenchmarkSpeed : 0; + var secondarySpeed = (_currentlySelectedAlgorithm is DualAlgorithm dualAlgo) ? _currentlySelectedAlgorithm.BenchmarkSecondarySpeed : 0; var speedString = Helpers.FormatDualSpeedOutput(_currentlySelectedAlgorithm.BenchmarkSpeed, secondarySpeed, _currentlySelectedAlgorithm.NiceHashID); AlgorithmType algo = AlgorithmType.NONE; /* diff --git a/NiceHashMiner/Forms/Components/AlgorithmsListView.cs b/NiceHashMiner/Forms/Components/AlgorithmsListView.cs index ae2c9ffaa..4a63bcc0d 100644 --- a/NiceHashMiner/Forms/Components/AlgorithmsListView.cs +++ b/NiceHashMiner/Forms/Components/AlgorithmsListView.cs @@ -250,6 +250,7 @@ public void SetAlgorithms(ComputeDevice computeDevice, bool isEnabled) name = dualAlg.DualAlgorithmNameCustom; miner = alg.MinerBaseTypeName; secondarySpeed = dualAlg.SecondaryBenchmarkSpeedString(); + //secondarySpeed = alg.SecondaryBenchmarkSpeedString(); totalSpeed = alg.BenchmarkSpeedString() + "/" + secondarySpeed; /* if (alg.NiceHashID == AlgorithmType.Autolykos && dualAlg.DualNiceHashID == AlgorithmType.DaggerHashimoto) @@ -257,7 +258,8 @@ public void SetAlgorithms(ComputeDevice computeDevice, bool isEnabled) payingRatio = alg.CurPayingRatio + "/" + dualAlg.SecondaryCurPayingRatio / 30; } */ - payingRatio = alg.CurPayingRatio + "/" +dualAlg.SecondaryCurPayingRatio; + //payingRatio = alg.CurPayingRatio + "/" +dualAlg.SecondaryCurPayingRatio; + payingRatio = alg.CurPayingRatio + "/" + alg.CurSecondPayingRatio; } else { @@ -372,7 +374,8 @@ public void UpdateLvi() { if (algorithm is DualAlgorithm dualAlg) { - lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + dualAlg.SecondaryCurPayingRatio; + //lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + dualAlg.SecondaryCurPayingRatio; + lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + algorithm.CurSecondPayingRatio; } else { @@ -447,6 +450,7 @@ public void RepaintStatus(bool isEnabled, string uuid) { // lvi.SubItems[SECSPEED].Text = dualAlg.SecondaryBenchmarkSpeedString(); lvi.SubItems[SPEED].Text = algo.BenchmarkSpeedString() + "/" + dualAlg.SecondaryBenchmarkSpeedString(); + //lvi.SubItems[SPEED].Text = algo.BenchmarkSpeedString() + "/" + algo.SecondaryBenchmarkSpeedString(); } else { @@ -596,8 +600,8 @@ public void SetSpeedStatus(ComputeDevice computeDevice, Algorithm algorithm, str if (algorithm is DualAlgorithm dualAlg) { - lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + dualAlg.SecondaryCurPayingRatio; - // lvi.SubItems[SECSPEED].Text = dualAlg.SecondaryBenchmarkSpeedString(); + //lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + dualAlg.SecondaryCurPayingRatio; + lvi.SubItems[RATIO].Text = algorithm.CurPayingRatio + "/" + algorithm.CurSecondPayingRatio; } else { @@ -847,10 +851,13 @@ private void ToolStripMenuItemClear_Click(object sender, EventArgs e) algorithm.BenchmarkSpeed = 0; if (algorithm is DualAlgorithm dualAlgo) { + algorithm.BenchmarkSecondarySpeed = 0; + /* dualAlgo.SecondaryBenchmarkSpeed = 0; dualAlgo.IntensitySpeeds = new Dictionary(); dualAlgo.SecondaryIntensitySpeeds = new Dictionary(); dualAlgo.IntensityUpToDate = false; + */ } RepaintStatus(_computeDevice.Enabled, _computeDevice.Uuid); diff --git a/NiceHashMiner/Forms/Components/DevicesListViewEnableControl.cs b/NiceHashMiner/Forms/Components/DevicesListViewEnableControl.cs index d823e6504..f7908bc30 100644 --- a/NiceHashMiner/Forms/Components/DevicesListViewEnableControl.cs +++ b/NiceHashMiner/Forms/Components/DevicesListViewEnableControl.cs @@ -168,7 +168,11 @@ public void SetComputeDevices(List computeDevices, bool includeCP { //continue; } - devNum = computeDevice.NameCount; ; + devNum = computeDevice.NameCount; + if (computeDevice.MonitorConnected) + { + devNum = "> " + devNum;// > GPU + } devInfo = computeDevice.Name; if (ConfigManager.GeneralConfig.Additional_info_about_device && computeDevice.DeviceType != DeviceType.CPU && diff --git a/NiceHashMiner/Forms/Form_Main.cs b/NiceHashMiner/Forms/Form_Main.cs index 6def97d5d..f912670db 100644 --- a/NiceHashMiner/Forms/Form_Main.cs +++ b/NiceHashMiner/Forms/Form_Main.cs @@ -1652,11 +1652,11 @@ public void ClearRates(int groupCount) { if (iApiData.SecondarySpeed > 0) { - speedString = speedStringRtf + "{\\*\\generator Riched20 10.0.19041}\\viewkind4\\uc1\\pard\\b\\f0\\fs17 " + International.GetText("ListView_Speed") + " " + Helpers.FormatSpeedOutput(iApiData.SecondarySpeed) + "H/s\\b0 Autolykos+\\b Zilliqua\\b\\par}"; + speedString = speedStringRtf + "{\\*\\generator Riched20 10.0.19041}\\viewkind4\\uc1\\pard\\b\\f0\\fs17 " + International.GetText("ListView_Speed") + " " + Helpers.FormatSpeedOutput(iApiData.SecondarySpeed) + "H/s\\b0 Autolykos+\\b Zilliqa\\b\\par}"; } else { - speedString = speedStringRtf + "{\\*\\generator Riched20 10.0.19041}\\viewkind4\\uc1\\pard\\b\\f0\\fs17 " + International.GetText("ListView_Speed") + " " + Helpers.FormatSpeedOutput(iApiData.Speed) + "H/s Autolykos\\b0 +Zilliqua\\b\\par}"; + speedString = speedStringRtf + "{\\*\\generator Riched20 10.0.19041}\\viewkind4\\uc1\\pard\\b\\f0\\fs17 " + International.GetText("ListView_Speed") + " " + Helpers.FormatSpeedOutput(iApiData.Speed) + "H/s Autolykos\\b0 +Zilliqa\\b\\par}"; } } @@ -1677,7 +1677,7 @@ public void ClearRates(int groupCount) // flowLayoutPanelRatesIndex may be OOB, so catch ((GroupProfitControl)flowLayoutPanelRates.Controls[_flowLayoutPanelRatesIndex++]) .UpdateProfitStats(groupName, deviceStringInfo, speedString, StartMinerTime, rateBtcString, rateCurrencyString, processTag); - + } catch (Exception ex) { diff --git a/NiceHashMiner/Forms/Form_Settings.Designer.cs b/NiceHashMiner/Forms/Form_Settings.Designer.cs index 32032fb15..3064f4f05 100644 --- a/NiceHashMiner/Forms/Form_Settings.Designer.cs +++ b/NiceHashMiner/Forms/Form_Settings.Designer.cs @@ -179,6 +179,7 @@ partial class Form_Settings this.groupBoxInfo = new System.Windows.Forms.GroupBox(); this.richTextBoxInfo = new System.Windows.Forms.RichTextBox(); this.buttonLicence = new System.Windows.Forms.Button(); + this.checkBox_DisplayConnected = new System.Windows.Forms.CheckBox(); this.tabControlGeneral.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); this.groupBox_Idle.SuspendLayout(); @@ -1335,6 +1336,7 @@ partial class Form_Settings // // groupBox1 // + this.groupBox1.Controls.Add(this.checkBox_DisplayConnected); this.groupBox1.Controls.Add(this.checkBox_show_AMDdevice_manufacturer); this.groupBox1.Controls.Add(this.checkBox_ShowDeviceMemSize); this.groupBox1.Controls.Add(this.checkBox_RunEthlargement); @@ -1462,7 +1464,7 @@ partial class Form_Settings // checkBoxRestartDriver // this.checkBoxRestartDriver.AutoSize = true; - this.checkBoxRestartDriver.Location = new System.Drawing.Point(304, 199); + this.checkBoxRestartDriver.Location = new System.Drawing.Point(304, 222); this.checkBoxRestartDriver.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.checkBoxRestartDriver.Name = "checkBoxRestartDriver"; this.checkBoxRestartDriver.Size = new System.Drawing.Size(206, 17); @@ -1474,7 +1476,7 @@ partial class Form_Settings // checkBoxRestartWindows // this.checkBoxRestartWindows.AutoSize = true; - this.checkBoxRestartWindows.Location = new System.Drawing.Point(304, 176); + this.checkBoxRestartWindows.Location = new System.Drawing.Point(304, 199); this.checkBoxRestartWindows.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.checkBoxRestartWindows.Name = "checkBoxRestartWindows"; this.checkBoxRestartWindows.Size = new System.Drawing.Size(224, 17); @@ -1498,7 +1500,7 @@ partial class Form_Settings // label_devices_count // this.label_devices_count.AutoSize = true; - this.label_devices_count.Location = new System.Drawing.Point(301, 134); + this.label_devices_count.Location = new System.Drawing.Point(301, 157); this.label_devices_count.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label_devices_count.Name = "label_devices_count"; this.label_devices_count.Size = new System.Drawing.Size(107, 13); @@ -1509,7 +1511,7 @@ partial class Form_Settings // this.comboBox_devices_count.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_devices_count.FormattingEnabled = true; - this.comboBox_devices_count.Location = new System.Drawing.Point(446, 131); + this.comboBox_devices_count.Location = new System.Drawing.Point(446, 154); this.comboBox_devices_count.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.comboBox_devices_count.Name = "comboBox_devices_count"; this.comboBox_devices_count.Size = new System.Drawing.Size(41, 21); @@ -1520,7 +1522,7 @@ partial class Form_Settings // this.checkBox_ShowFanAsPercent.AutoSize = true; this.checkBox_ShowFanAsPercent.ForeColor = System.Drawing.SystemColors.ControlText; - this.checkBox_ShowFanAsPercent.Location = new System.Drawing.Point(304, 111); + this.checkBox_ShowFanAsPercent.Location = new System.Drawing.Point(304, 134); this.checkBox_ShowFanAsPercent.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.checkBox_ShowFanAsPercent.Name = "checkBox_ShowFanAsPercent"; this.checkBox_ShowFanAsPercent.Size = new System.Drawing.Size(144, 17); @@ -2175,6 +2177,18 @@ partial class Form_Settings this.buttonLicence.UseVisualStyleBackColor = true; this.buttonLicence.Click += new System.EventHandler(this.buttonLicence_Click); // + // checkBox_DisplayConnected + // + this.checkBox_DisplayConnected.AutoSize = true; + this.checkBox_DisplayConnected.ForeColor = System.Drawing.SystemColors.ControlText; + this.checkBox_DisplayConnected.Location = new System.Drawing.Point(304, 110); + this.checkBox_DisplayConnected.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); + this.checkBox_DisplayConnected.Name = "checkBox_DisplayConnected"; + this.checkBox_DisplayConnected.Size = new System.Drawing.Size(221, 17); + this.checkBox_DisplayConnected.TabIndex = 416; + this.checkBox_DisplayConnected.Text = "Show which GPU display is connected to"; + this.checkBox_DisplayConnected.UseVisualStyleBackColor = true; + // // Form_Settings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2414,5 +2428,6 @@ partial class Form_Settings private System.Windows.Forms.CheckBox checkBox_By_profitability_of_all_devices; public System.Windows.Forms.LinkLabel linkLabel3; private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.CheckBox checkBox_DisplayConnected; } } diff --git a/NiceHashMiner/Forms/Form_Settings.cs b/NiceHashMiner/Forms/Form_Settings.cs index c74502d2b..d8ec71938 100644 --- a/NiceHashMiner/Forms/Form_Settings.cs +++ b/NiceHashMiner/Forms/Form_Settings.cs @@ -462,6 +462,7 @@ private void InitializeGeneralTabTranslations() checkBox_Allow_remote_management.Text = International.GetText("Form_Settings_checkBox_Allow_remote_management"); checkBox_Send_actual_version_info.Text = International.GetText("Form_Settings_checkBox_Send_actual_version_info"); checkBox_Additional_info_about_device.Text = International.GetText("Form_Settings_checkBox_Additional_info_about_device"); + checkBox_DisplayConnected.Text = International.GetText("Form_Settings_checkBox_DisplayConnected"); checkBox_show_NVdevice_manufacturer.Text = International.GetText("Form_Settings_checkBox_show_NVdevice_manufacturer"); checkBox_show_AMDdevice_manufacturer.Text = International.GetText("Form_Settings_checkBox_show_AMDdevice_manufacturer"); @@ -796,6 +797,9 @@ private void InitializeGeneralTabTranslations() checkBox_Additional_info_about_device.BackColor = Form_Main._backColor; checkBox_Additional_info_about_device.ForeColor = Form_Main._textColor; + checkBox_DisplayConnected.BackColor = Form_Main._backColor; + checkBox_DisplayConnected.ForeColor = Form_Main._textColor; + checkBox_show_NVdevice_manufacturer.BackColor = Form_Main._backColor; checkBox_show_NVdevice_manufacturer.ForeColor = Form_Main._textColor; checkBox_show_AMDdevice_manufacturer.BackColor = Form_Main._backColor; @@ -975,6 +979,7 @@ private void InitializeGeneralTabCallbacks() checkbox_current_actual_profitabilities.CheckedChanged += GeneralCheckBoxes_CheckedChanged; checkBox_Show_profit_with_power_consumption.CheckedChanged += GeneralCheckBoxes_CheckedChanged; checkBox_Additional_info_about_device.CheckedChanged += GeneralCheckBoxes_CheckedChanged; + checkBox_DisplayConnected.CheckedChanged += GeneralCheckBoxes_CheckedChanged; checkBox_show_NVdevice_manufacturer.CheckedChanged += GeneralCheckBoxes_CheckedChanged; checkBox_show_AMDdevice_manufacturer.CheckedChanged += GeneralCheckBoxes_CheckedChanged; checkBox_ShowDeviceMemSize.CheckedChanged += GeneralCheckBoxes_CheckedChanged; @@ -1079,6 +1084,7 @@ private void InitializeGeneralTabFieldValuesReferences() checkBox_Show_profit_with_power_consumption.Checked = ConfigManager.GeneralConfig.DecreasePowerCost; checkBox_fiat.Checked = ConfigManager.GeneralConfig.FiatCurrency; checkBox_Additional_info_about_device.Checked = ConfigManager.GeneralConfig.Additional_info_about_device; + checkBox_DisplayConnected.Checked = ConfigManager.GeneralConfig.Show_displayConected; checkBox_show_NVdevice_manufacturer.Checked = ConfigManager.GeneralConfig.Show_NVdevice_manufacturer; checkBox_show_AMDdevice_manufacturer.Checked = ConfigManager.GeneralConfig.Show_AMDdevice_manufacturer; checkBox_ShowDeviceMemSize.Checked = ConfigManager.GeneralConfig.Show_ShowDeviceMemSize; @@ -1238,6 +1244,7 @@ private void GeneralCheckBoxes_CheckedChanged(object sender, EventArgs e) ConfigManager.GeneralConfig.DecreasePowerCost = checkBox_Show_profit_with_power_consumption.Checked; ConfigManager.GeneralConfig.FiatCurrency = checkBox_fiat.Checked; ConfigManager.GeneralConfig.Additional_info_about_device = checkBox_Additional_info_about_device.Checked; + ConfigManager.GeneralConfig.Show_displayConected = checkBox_DisplayConnected.Checked; ConfigManager.GeneralConfig.Show_NVdevice_manufacturer = checkBox_show_NVdevice_manufacturer.Checked; ConfigManager.GeneralConfig.Show_AMDdevice_manufacturer = checkBox_show_AMDdevice_manufacturer.Checked; ConfigManager.GeneralConfig.Show_ShowDeviceMemSize = checkBox_ShowDeviceMemSize.Checked; diff --git a/NiceHashMiner/Forms/WaitingForm.cs b/NiceHashMiner/Forms/WaitingForm.cs index 7b14e6466..35074e0d0 100644 --- a/NiceHashMiner/Forms/WaitingForm.cs +++ b/NiceHashMiner/Forms/WaitingForm.cs @@ -35,9 +35,15 @@ private void WaitingForm_FormClosing(object sender, FormClosingEventArgs e) } public void CloseWaitingBox() { - _ended = true; - System.Threading.Thread.Sleep(200); - task1.Dispose(); + try + { + _ended = true; + System.Threading.Thread.Sleep(200); + task1.Dispose(); + } catch (Exception ex) + { + + } } public void ShowWaitingBox() { diff --git a/NiceHashMiner/Miners/Grouping/GroupSetupUtils.cs b/NiceHashMiner/Miners/Grouping/GroupSetupUtils.cs index e8c9fe6bd..6fe980f86 100644 --- a/NiceHashMiner/Miners/Grouping/GroupSetupUtils.cs +++ b/NiceHashMiner/Miners/Grouping/GroupSetupUtils.cs @@ -268,7 +268,8 @@ public void AddAlgorithms(List algos) double secondarySpeed = 0; if (algo is DualAlgorithm dualAlgo) { - secondarySpeed = dualAlgo.SecondaryBenchmarkSpeed; + //secondarySpeed = dualAlgo.SecondaryBenchmarkSpeed; + secondarySpeed = algo.BenchmarkSecondarySpeed; } if (BenchmarkSums.ContainsKey(algoID) == false) { diff --git a/NiceHashMiner/Miners/Miner.cs b/NiceHashMiner/Miners/Miner.cs index 29265c9ea..9900c9e14 100644 --- a/NiceHashMiner/Miners/Miner.cs +++ b/NiceHashMiner/Miners/Miner.cs @@ -723,8 +723,6 @@ public virtual void BenchmarkStart(int time, IBenchmarkComunicator benchmarkComu var benchmarkThread = new Thread(BenchmarkThreadRoutine, time); benchmarkThread.Start(commandLine); - - } protected virtual Process BenchmarkStartProcess(string commandLine) @@ -987,13 +985,9 @@ protected void BenchmarkThreadRoutineFinish() BenchmarkProcessStatus = status; if (BenchmarkAlgorithm is DualAlgorithm dualAlg) { - if (!dualAlg.TuningEnabled) - { - // Tuning will report speed - Helpers.ConsolePrint("BENCHMARK-finish", - "Final Speed: " + Helpers.FormatDualSpeedOutput(dualAlg.BenchmarkSpeed, - dualAlg.SecondaryBenchmarkSpeed, dualAlg.DualNiceHashID)); - } + Helpers.ConsolePrint("BENCHMARK-finish", + "Final Speed: " + Helpers.FormatDualSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed, + BenchmarkAlgorithm.BenchmarkSecondarySpeed, dualAlg.DualNiceHashID)); } else { @@ -1069,6 +1063,61 @@ protected virtual void BenchmarkThreadRoutine(object commandLine) } } + protected virtual void BenchmarkThreadRoutineSecond(object commandLine) + { + BenchmarkSignalQuit = false; + BenchmarkSignalHanged = false; + BenchmarkSignalFinnished = false; + BenchmarkException = null; + + Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); + + try + { + Helpers.ConsolePrint("BENCHMARK-routine", "Second Benchmark starts"); + BenchmarkHandle = BenchmarkStartProcess((string)commandLine); + + BenchmarkThreadRoutineStartSettup(); + // wait a little longer then the benchmark routine if exit false throw + //var timeoutTime = BenchmarkTimeoutInSeconds(BenchmarkTimeInSeconds); + //var exitSucces = BenchmarkHandle.WaitForExit(timeoutTime * 1000); + // don't use wait for it breaks everything + BenchmarkProcessStatus = BenchmarkProcessStatus.Running; + var exited = BenchmarkHandle.WaitForExit((BenchmarkTimeoutInSeconds(BenchmarkTimeInSeconds) + 20) * 1000); + if (BenchmarkSignalTimedout && !TimeoutStandard) + { + throw new Exception("Benchmark timedout"); + } + + if (BenchmarkException != null) + { + throw BenchmarkException; + } + + if (BenchmarkSignalQuit) + { + throw new Exception("Termined by user request"); + } + + if (BenchmarkSignalHanged || !exited) + { + throw new Exception("Miner is not responding"); + } + + if (BenchmarkSignalFinnished) + { + //break; + } + } + catch (Exception ex) + { + BenchmarkThreadRoutineCatch(ex); + } + finally + { + BenchmarkThreadRoutineFinish(); + } + } protected void BenchmarkThreadRoutineAlternate(object commandLine, int benchmarkTimeWait) { CleanOldLogs(); diff --git a/NiceHashMiner/Miners/Nanominer.cs b/NiceHashMiner/Miners/Nanominer.cs index 2114261b1..dfe3ec5e2 100644 --- a/NiceHashMiner/Miners/Nanominer.cs +++ b/NiceHashMiner/Miners/Nanominer.cs @@ -8,8 +8,6 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Net.Sockets; -using System.Text; using System.Threading; using System.Threading.Tasks; using NiceHashMiner.Algorithms; @@ -30,6 +28,7 @@ public class Nanominer : Miner public FileStream fs; private int offset = 0; private bool zilRound = false; + private bool IsInBenchmark = false; public Nanominer() : base("Nanominer") { @@ -53,6 +52,7 @@ public override void Start(string url, string btcAdress, string worker) private string GetStartCommand(string url, string btcAdress, string worker) { + IsInBenchmark = false; var param = ""; foreach (var pair in MiningSetup.MiningPairs) { @@ -92,7 +92,40 @@ private string GetStartCommand(string url, string btcAdress, string worker) + String.Format("pool4 = daggerhashimoto.{0}.nicehash.com:3353", Form_Main.myServers[2, 0]) + "\n" + String.Format("pool5 = daggerhashimoto.{0}.nicehash.com:3353", Form_Main.myServers[3, 0]) + "\n"; } - if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos)) + { + if (File.Exists("miners\\Nanominer\\" + GetLogFileName())) + File.Delete("miners\\Nanominer\\" + GetLogFileName()); + + cfgFile = + String.Format("webPort = {0}", ApiPort) + "\n" + + String.Format("mport = 0\n") + + String.Format("logPath=" + GetLogFileName() + "\n") + + String.Format(param) + "\n" + + String.Format("[autolykos]\n") + + String.Format("devices = {0}", GetDevicesCommandString()) + "\n" + + String.Format("wallet = {0}", btcAdress) + "\n" + + String.Format("rigName = \"{0}\"", rigName) + "\n" + + String.Format("protocol = stratum\n") + + String.Format("pool1 = {0}", url) + "\n" + + String.Format("pool2 = autolykos.{0}.nicehash.com:3390", Form_Main.myServers[0, 0]) + "\n" + + String.Format("pool3 = autolykos.{0}.nicehash.com:3390", Form_Main.myServers[1, 0]) + "\n" + + String.Format("pool4 = autolykos.{0}.nicehash.com:3390", Form_Main.myServers[2, 0]) + "\n" + + String.Format("pool5 = autolykos.{0}.nicehash.com:3390", Form_Main.myServers[3, 0]) + "\n"; + } + try + { + FileStream fs = new FileStream("miners\\Nanominer\\config_nh_" + platform + ".ini", FileMode.Create, FileAccess.Write); + StreamWriter w = new StreamWriter(fs); + w.WriteAsync(cfgFile); + w.Flush(); + w.Close(); + } + catch (Exception e) + { + Helpers.ConsolePrint("GetStartCommand", e.ToString()); + } + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos) && MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) { if (File.Exists("miners\\Nanominer\\" + GetLogFileName())) File.Delete("miners\\Nanominer\\" + GetLogFileName()); @@ -137,11 +170,6 @@ private string GetStartCommand(string url, string btcAdress, string worker) } return " config_nh_" + platform + ".ini"; - /* - + - ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD) + - ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA); - */ } @@ -251,8 +279,8 @@ protected bool IsProcessExist() protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int time) { - //Random R = new Random(); - //Thread.Sleep(R.Next(1, 10) * 1000); + IsInBenchmark = true; + if (Form_Main.nanominerCount > 0) { do @@ -282,7 +310,10 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti if (File.Exists("miners\\Nanominer\\bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini")) File.Delete("miners\\Nanominer\\bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini"); - if (MiningSetup.CurrentAlgorithmType == AlgorithmType.DaggerHashimoto) + if (File.Exists("miners\\Nanominer\\bench_nh_second" + GetDevicesCommandString().Trim(' ') + ".ini")) + File.Delete("miners\\Nanominer\\bench_nh_second" + GetDevicesCommandString().Trim(' ') + ".ini"); + + if (algorithm.NiceHashID == AlgorithmType.DaggerHashimoto) { var cfgFile = String.Format("webPort = {0}", ApiPort) + "\n" @@ -313,6 +344,92 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti _benchmarkTimeWait = time; } + if (algorithm.NiceHashID == AlgorithmType.Autolykos && algorithm.DualNiceHashID == AlgorithmType.Autolykos) + { + var cfgFile = + String.Format("webPort = {0}", ApiPort) + "\n" + + String.Format("mport = 0\n") + + String.Format("protocol = stratum\n") + + String.Format("watchdog = false\n") + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD).TrimStart(' ') + (char)10 + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA).TrimStart(' ') + (char)10 + + String.Format("[autolykos]\n") + + String.Format("devices = {0}", GetDevicesCommandString().Trim(' ')) + "\n" + + String.Format("wallet = 9gnVDaLeFa4ETwtrceHepPe9JeaCBGV1PxV5tdNGAvqEmjWF2Lt") + "\n" + + String.Format("rigName = Nanominer") + "\n" + + String.Format("pool1 = pool.eu.woolypooly.com:3100") + "\n"; + + try + { + FileStream fs = new FileStream("miners\\Nanominer\\bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini", FileMode.Create, FileAccess.Write); + StreamWriter w = new StreamWriter(fs); + w.WriteAsync(cfgFile); + w.Flush(); + w.Close(); + } + catch (Exception e) + { + Helpers.ConsolePrint("GetStartCommand", e.ToString()); + } + //Thread.Sleep(1000); + _benchmarkTimeWait = time; + } + if (algorithm.NiceHashID == AlgorithmType.Autolykos && algorithm.DualNiceHashID == AlgorithmType.AutolykosZil) + { + var cfgFile = + String.Format("webPort = {0}", ApiPort) + "\n" + + String.Format("mport = 0\n") + + String.Format("protocol = stratum\n") + + String.Format("watchdog = false\n") + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD).TrimStart(' ') + (char)10 + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA).TrimStart(' ') + (char)10 + + String.Format("[autolykos]\n") + + String.Format("devices = {0}", GetDevicesCommandString().Trim(' ')) + "\n" + + String.Format("wallet = 9gnVDaLeFa4ETwtrceHepPe9JeaCBGV1PxV5tdNGAvqEmjWF2Lt") + "\n" + + String.Format("rigName = NanominerZil") + "\n" + + String.Format("pool1 = pool.eu.woolypooly.com:3100") + "\n"; + + try + { + FileStream fs = new FileStream("miners\\Nanominer\\bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini", FileMode.Create, FileAccess.Write); + StreamWriter w = new StreamWriter(fs); + w.WriteAsync(cfgFile); + w.Flush(); + w.Close(); + } + catch (Exception e) + { + Helpers.ConsolePrint("GetStartCommand", e.ToString()); + } + var cfgFile2 = + String.Format("webPort = {0}", ApiPort) + "\n" + + String.Format("mport = 0\n") + + String.Format("protocol = stratum\n") + + String.Format("watchdog = false\n") + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD).TrimStart(' ') + (char)10 + + ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.NVIDIA).TrimStart(' ') + (char)10 + + String.Format("[ethash]\n") + + String.Format("devices = {0}", GetDevicesCommandString().Trim(' ')) + "\n" + + String.Format("wallet = angelbbs") + "\n" + + String.Format("rigName = NanominerZil") + "\n" + + String.Format("pool1 = us-east.ethash-hub.miningpoolhub.com:20565") + "\n"; + + try + { + FileStream fs = new FileStream("miners\\Nanominer\\bench_nh_second" + GetDevicesCommandString().Trim(' ') + ".ini", FileMode.Create, FileAccess.Write); + StreamWriter w = new StreamWriter(fs); + w.WriteAsync(cfgFile2); + w.Flush(); + w.Close(); + } + catch (Exception e) + { + Helpers.ConsolePrint("GetStartCommand", e.ToString()); + } + + _benchmarkTimeWait = time; + } + return " bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini"; } @@ -390,6 +507,7 @@ protected override void BenchmarkThreadRoutine(object commandLine) try { + double BenchmarkSpeed = 0.0d; Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in: " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); @@ -434,8 +552,6 @@ protected override void BenchmarkThreadRoutine(object commandLine) { break; } - - //keepRunning = false; break; } // wait a second due api request @@ -459,7 +575,8 @@ protected override void BenchmarkThreadRoutine(object commandLine) if (repeats >= _benchmarkTimeWait - MinerStartDelay - 15) { - Helpers.ConsolePrint(MinerTag(), "Benchmark ended"); + BenchmarkSpeed = Math.Round(summspeed / (repeats - delay_before_calc_hashrate), 2); + Helpers.ConsolePrint(MinerTag(), "Benchmark ended. BenchmarkSpeed: " + BenchmarkSpeed.ToString()); ad.Dispose(); benchmarkTimer.Stop(); @@ -472,7 +589,12 @@ protected override void BenchmarkThreadRoutine(object commandLine) } } - BenchmarkAlgorithm.BenchmarkSpeed = Math.Round(summspeed / (repeats - delay_before_calc_hashrate), 2); + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos) && MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + { + BenchmarkAlgorithm.BenchmarkProgressPercent = -1; + BenchmarkThreadRoutineSecond(); + } + BenchmarkAlgorithm.BenchmarkSpeed = BenchmarkSpeed; } catch (Exception ex) { @@ -480,11 +602,122 @@ protected override void BenchmarkThreadRoutine(object commandLine) } finally { - + EndBenchmarkProcces(); BenchmarkThreadRoutineFinish(); Form_Main.nanominerCount--; } } + private void BenchmarkThreadRoutineSecond() + { + double BenchmarkSpeed = 0.0d; + BenchmarkSignalQuit = false; + BenchmarkSignalHanged = false; + BenchmarkSignalFinnished = false; + BenchmarkException = null; + double repeats = 0.0d; + double summspeedSecond = 0.0d; + + int delay_before_calc_hashrate = 10; + int MinerStartDelay = 20; + + Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); + + try + { + Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); + Helpers.ConsolePrint(MinerTag(), "Benchmark should end in: " + _benchmarkTimeWait + " seconds"); + BenchmarkHandle = BenchmarkStartProcess(" bench_nh" + GetDevicesCommandString().Trim(' ') + ".ini"); + //BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); + var benchmarkTimer = new Stopwatch(); + benchmarkTimer.Reset(); + benchmarkTimer.Start(); + + BenchmarkProcessStatus = BenchmarkProcessStatus.Running; + BenchmarkThreadRoutineStartSettup(); //need for benchmark log + while (IsActiveProcess(BenchmarkHandle.Id)) + { + if (benchmarkTimer.Elapsed.TotalSeconds >= (_benchmarkTimeWait + 60) + || BenchmarkSignalQuit + || BenchmarkSignalFinnished + || BenchmarkSignalHanged + || BenchmarkSignalTimedout + || BenchmarkException != null) + { + var imageName = MinerExeName.Replace(".exe", ""); + // maybe will have to KILL process + BenchmarkHandle.Kill(); + BenchmarkHandle.Dispose(); + EndBenchmarkProcces(); + // KillMinerBase(imageName); + if (BenchmarkSignalTimedout) + { + throw new Exception("Benchmark timedout"); + } + + if (BenchmarkException != null) + { + throw BenchmarkException; + } + + if (BenchmarkSignalQuit) + { + throw new Exception("Termined by user request"); + } + + if (BenchmarkSignalFinnished) + { + break; + } + break; + } + // wait a second due api request + Thread.Sleep(1000); + + var ad = GetSummaryAsync(); + if (ad.Result != null && ad.Result.Speed > 0) + { + repeats++; + double benchProgress = repeats / (_benchmarkTimeWait - MinerStartDelay - 15); + BenchmarkAlgorithm.BenchmarkProgressPercent = (int)(benchProgress * 100); + if (repeats > delay_before_calc_hashrate) + { + Helpers.ConsolePrint(MinerTag(), "Useful API Speed: " + ad.Result.Speed.ToString()); + summspeedSecond += ad.Result.Speed; + } + else + { + Helpers.ConsolePrint(MinerTag(), "Delayed API Speed: " + ad.Result.Speed.ToString()); + } + + if (repeats >= _benchmarkTimeWait - MinerStartDelay - 15) + { + BenchmarkSpeed = Math.Round(summspeedSecond / (repeats - delay_before_calc_hashrate), 2); + Helpers.ConsolePrint(MinerTag(), "Benchmark ended. BenchmarkSpeed: " + BenchmarkSpeed.ToString()); + ad.Dispose(); + benchmarkTimer.Stop(); + + BenchmarkHandle.Kill(); + BenchmarkHandle.Dispose(); + //EndBenchmarkProcces(); + + break; + } + + } + } + BenchmarkAlgorithm.BenchmarkSecondarySpeed = Math.Round(summspeedSecond / (repeats - delay_before_calc_hashrate), 2); + } + catch (Exception ex) + { + BenchmarkThreadRoutineCatch(ex); + } + finally + { + + //BenchmarkThreadRoutineFinish(); + Form_Main.nanominerCount--; + } + } // stub benchmarks read from file protected override void BenchmarkOutputErrorDataReceivedImpl(string outdata) { @@ -494,12 +727,7 @@ protected override bool BenchmarkParseLine(string outdata) { return true; } - /* - protected override bool BenchmarkParseLine(string outdata) - { - return false; - } - */ + protected double GetNumber(string outdata) { return GetNumber(outdata, "Total speed: ", "H/s, Total shares"); @@ -617,7 +845,7 @@ public override async Task GetSummaryAsync() sortedMinerPairs[i].Device.MiningHashrate = gpu_hr; } } - if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto) && !IsInBenchmark) { dynamic json = JsonConvert.DeserializeObject(ResponseFromNanominer.Replace("GPU ", "GPU")); if (json == null) return ad; @@ -644,7 +872,7 @@ public override async Task GetSummaryAsync() fs.Read(array, 0, count); offset = (int)fs.Length; string textFromFile = System.Text.Encoding.Default.GetString(array).Trim(); - Helpers.ConsolePrint(MinerTag(), textFromFile); + //Helpers.ConsolePrint(MinerTag(), textFromFile); string strStart = "Zilliqa - Total speed:"; if (textFromFile.Contains(strStart) && textFromFile.Contains("H/s")) @@ -688,6 +916,38 @@ public override async Task GetSummaryAsync() } } } + //for benchmark + if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto) && IsInBenchmark) + { + bool IsZil = false; + if (ResponseFromNanominer.Contains("Zilliqa")) + { + IsZil = true; + } + dynamic json = JsonConvert.DeserializeObject(ResponseFromNanominer.Replace("GPU ", "GPU")); + if (json == null) return ad; + var cSpeed1 = (json.Algorithms[0].Autolykos); + if (cSpeed1 == null) return ad; + var cSpeed = (json.Algorithms[0].Autolykos.Total.Hashrate); + dSpeed1 = (int)Convert.ToDouble(cSpeed, CultureInfo.InvariantCulture.NumberFormat); + + for (int i = 0; i < sortedMinerPairs.Count; i++) + { + string gpu = devices[i]; + string token = ""; + if (IsZil) + { + token = $"Algorithms[0].Zilliqa.GPU{gpu}.Hashrate"; + } + else + { + token = $"Algorithms[0].Autolykos.GPU{gpu}.Hashrate"; + } + var hash = (string)json.SelectToken(token); + var gpu_hr = (int)Convert.ToDouble(hash, CultureInfo.InvariantCulture.NumberFormat); + sortedMinerPairs[i].Device.MiningHashrate = gpu_hr; + } + } } catch (Exception ex) { @@ -731,19 +991,14 @@ public override async Task GetSummaryAsync() JsonApiResponse resp = null; try { - Helpers.ConsolePrint("ClaymoreMiner API: ", "********* 1"); var bytesToSend = Encoding.ASCII.GetBytes("{\"id\":0,\"jsonrpc\":\"2.0\",\"method\":\"miner_getstat1\"}\r\n"); var client = new TcpClient("127.0.0.1", ApiPort); - Helpers.ConsolePrint("ClaymoreMiner API: ", "********* 2"); var nwStream = client.GetStream(); - Helpers.ConsolePrint("ClaymoreMiner API: ", "********* 3"); nwStream.ReadTimeout = 2 * 1000; nwStream.WriteTimeout = 2 * 1000; await nwStream.WriteAsync(bytesToSend, 0, bytesToSend.Length); - Helpers.ConsolePrint("ClaymoreMiner API: ", "********* 4"); var bytesToRead = new byte[client.ReceiveBufferSize]; var bytesRead = await nwStream.ReadAsync(bytesToRead, 0, client.ReceiveBufferSize); - Helpers.ConsolePrint("ClaymoreMiner API: ", "********* 5"); var respStr = Encoding.ASCII.GetString(bytesToRead, 0, bytesRead); resp = JsonConvert.DeserializeObject(respStr, Globals.JsonSettings); client.Close(); @@ -773,8 +1028,7 @@ public override async Task GetSummaryAsync() int dev = 0; foreach (var speed in speeds) { - Helpers.ConsolePrint("ClaymoreMiner API: ", "speed: " + speed); - //Helpers.ConsolePrint("ClaymoreMiner API: ", "secondarySpeeds: " + secondarySpeeds.ToString()); + Helpers.ConsolePrint("API: ", "speed: " + speed); double tmpSpeed; try { @@ -784,7 +1038,7 @@ public override async Task GetSummaryAsync() { tmpSpeed = 0; } - Helpers.ConsolePrint("ClaymoreMiner API: ", "tmpSpeed" + tmpSpeed.ToString()); + Helpers.ConsolePrint("API: ", "tmpSpeed" + tmpSpeed.ToString()); if (!speed.Contains("off")) { @@ -796,7 +1050,7 @@ public override async Task GetSummaryAsync() foreach (var speed in secondarySpeeds) { - Helpers.ConsolePrint("ClaymoreMiner API: ", "secondarySpeeds " + secondarySpeeds); + Helpers.ConsolePrint("API: ", "secondarySpeeds " + secondarySpeeds); double tmpSpeed; try { @@ -806,7 +1060,7 @@ public override async Task GetSummaryAsync() { tmpSpeed = 0; } - Helpers.ConsolePrint("ClaymoreMiner API: ", "tmpSpeed2" + tmpSpeed.ToString()); + Helpers.ConsolePrint("API: ", "tmpSpeed2" + tmpSpeed.ToString()); ad.SecondarySpeed += tmpSpeed; if (tmpSpeed > 0) { @@ -833,7 +1087,6 @@ public override async Task GetSummaryAsync() { int count = (int)(fs.Length - offset); byte[] array = new byte[count]; - Helpers.ConsolePrint(MinerTag(), "* fs.Length: " + fs.Length.ToString() + "array.Length: " + array.Length.ToString() + " offset: " + offset.ToString() + " count: " + count.ToString()); fs.Read(array, 0, count); offset = (int)fs.Length; diff --git a/NiceHashMiner/Miners/SRBMiner.cs b/NiceHashMiner/Miners/SRBMiner.cs index 5efe30f89..d8d3ab3e8 100644 --- a/NiceHashMiner/Miners/SRBMiner.cs +++ b/NiceHashMiner/Miners/SRBMiner.cs @@ -26,17 +26,18 @@ public class SRBMiner : Miner private readonly int GPUPlatformNumber; private int _benchmarkTimeWait = 180; - // private int TotalCount = 2; private const int TotalDelim = 2; int count = 0; private double speed = 0; private double tmp = 0; + private bool IsInBenchmark = false; public SRBMiner() : base("SRBMiner") { GPUPlatformNumber = ComputeDeviceManager.Available.AmdOpenCLPlatformNum; } public override void Start(string url, string btcAdress, string worker) { + IsInBenchmark = false; //IsApiReadException = MiningSetup.MinerPath == MinerPaths.Data.SRBMiner; LastCommandLine = GetStartCommand(url, btcAdress, worker); @@ -112,16 +113,14 @@ protected override string GetDevicesCommandString() } private string GetStartBenchmarkCommand(string url, string btcAddress, string worker) { + IsInBenchmark = true; var LastCommandLine = GetStartCommand(url, btcAddress, worker); var extras = ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD); string algo; string port; string username = GetUsername(btcAddress, worker); url = url.Replace("stratum+tcp://", ""); - if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.AutolykosZil)) - { - // MessageBox.Show(""); - } + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.RandomX)) { algo = "randomxmonero"; @@ -215,6 +214,7 @@ public override async Task GetSummaryAsync() dynamic resp = JsonConvert.DeserializeObject(ResponseFromSRBMiner); //Helpers.ConsolePrint("API ResponseFromSRBMiner:", ResponseFromSRBMiner.ToString()); + try { int totalsMain = 0; @@ -248,20 +248,24 @@ public override async Task GetSummaryAsync() } if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) { - //MessageBox.Show((MiningSetup.CurrentSecondaryAlgorithmType.ToString())); devs = 0; foreach (var mPair in sortedMinerPairs) { try { + int gpu_hr1 = 0; string token0 = $"algorithms[0].hashrate.gpu.gpu{mPair.Device.IDByBus}"; var hash0 = resp.SelectToken(token0); int gpu_hr0 = (int)Convert.ToInt32(hash0, CultureInfo.InvariantCulture.NumberFormat); - - string token1 = $"algorithms[1].hashrate.gpu.gpu{mPair.Device.IDByBus}"; - var hash1 = resp.SelectToken(token1); - int gpu_hr1 = (int)Convert.ToInt32(hash1, CultureInfo.InvariantCulture.NumberFormat); - + if (IsInBenchmark == false) + { + string token1 = $"algorithms[1].hashrate.gpu.gpu{mPair.Device.IDByBus}"; + var hash1 = resp.SelectToken(token1); + gpu_hr1 = (int)Convert.ToInt32(hash1, CultureInfo.InvariantCulture.NumberFormat); + } else + { + gpu_hr1 = 0; + } if (gpu_hr0 > 0) { mPair.Device.MiningHashrate = gpu_hr0; @@ -277,10 +281,14 @@ public override async Task GetSummaryAsync() } devs++; } - - totalsMain = resp.algorithms[1].hashrate.gpu.total; - totalsSecond = resp.algorithms[0].hashrate.gpu.total; - + if (IsInBenchmark == false) + { + totalsMain = resp.algorithms[1].hashrate.gpu.total; + totalsSecond = resp.algorithms[0].hashrate.gpu.total; + } else + { + totalsMain = resp.algorithms[0].hashrate.gpu.total; + } } if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.RandomX)) { @@ -291,7 +299,6 @@ public override async Task GetSummaryAsync() } } - ad.Speed = totalsMain; ad.SecondarySpeed = totalsSecond; @@ -307,6 +314,7 @@ public override async Task GetSummaryAsync() } catch (Exception ex) { Helpers.ConsolePrint("API error", ex.Message); + Helpers.ConsolePrint("API error", ex.ToString()); CurrentMinerReadStatus = MinerApiReadStatus.READ_SPEED_ZERO; ad.Speed = 0; return ad; @@ -314,8 +322,6 @@ public override async Task GetSummaryAsync() Thread.Sleep(1); return ad; - - } protected override bool IsApiEof(byte third, byte second, byte last) { @@ -343,15 +349,15 @@ protected override void BenchmarkThreadRoutine(object commandLine) int delay_before_calc_hashrate = 10; int MinerStartDelay = 10; - + Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); try { + double BenchmarkSpeed = 0.0d; Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in: " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); - //BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); var benchmarkTimer = new Stopwatch(); benchmarkTimer.Reset(); benchmarkTimer.Start(); @@ -390,8 +396,6 @@ protected override void BenchmarkThreadRoutine(object commandLine) { break; } - - //keepRunning = false; break; } // wait a second due api request @@ -415,28 +419,42 @@ protected override void BenchmarkThreadRoutine(object commandLine) if (repeats >= _benchmarkTimeWait - MinerStartDelay - 15) { - Helpers.ConsolePrint(MinerTag(), "Benchmark ended"); + BenchmarkSpeed = Math.Round(summspeed / (repeats - delay_before_calc_hashrate), 2); + Helpers.ConsolePrint(MinerTag(), "Benchmark ended. BenchmarkSpeed: " + BenchmarkSpeed.ToString()); ad.Dispose(); benchmarkTimer.Stop(); BenchmarkHandle.Kill(); BenchmarkHandle.Dispose(); - EndBenchmarkProcces(); + if (!MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + { + //EndBenchmarkProcces(); + } StopDriver(); break; } } } - BenchmarkAlgorithm.BenchmarkSpeed = Math.Round(summspeed / (repeats - delay_before_calc_hashrate), 2); + + if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + { + BenchmarkAlgorithm.BenchmarkProgressPercent = -1; + BenchmarkThreadRoutineSecond(); + } + BenchmarkAlgorithm.BenchmarkSpeed = BenchmarkSpeed; + } catch (Exception ex) { + Helpers.ConsolePrint(MinerTag(), ex.ToString()); BenchmarkThreadRoutineCatch(ex); } finally { + EndBenchmarkProcces(); BenchmarkThreadRoutineFinish(); + // find latest log file string latestLogFile = ""; var dirInfo = new DirectoryInfo(WorkingDirectory); @@ -467,7 +485,152 @@ protected override void BenchmarkThreadRoutine(object commandLine) } } } + private void BenchmarkThreadRoutineSecond() + { + if (MiningSetup.CurrentSecondaryAlgorithmType.Equals(AlgorithmType.DaggerHashimoto)) + { + BenchmarkSignalQuit = false; + BenchmarkSignalHanged = false; + BenchmarkSignalFinnished = false; + BenchmarkException = null; + double repeats = 0; + double summspeedSecond = 0.0d; + + int delay_before_calc_hashrate = 10; + int MinerStartDelay = 10; + + Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); + + try + { + var extras = ExtraLaunchParametersParser.ParseForMiningSetup(MiningSetup, DeviceType.AMD); + string secondcommandLine = $" --disable-cpu --algorithm ethash" + + $" --pool stratum+tcp://us-east.ethash-hub.miningpoolhub.com:20565" + + $" --wallet angelbbs.SRBMiner --nicehash true" + + $" --api-enable --api-port {ApiPort} --extended-log --log-file {GetLogFileName()}" + + " --gpu-id " + GetDevicesCommandString().Trim() + " " + extras; + Helpers.ConsolePrint("BENCHMARK", "Second Benchmark starts"); + Helpers.ConsolePrint(MinerTag(), "Second Benchmark should end in: " + _benchmarkTimeWait + " seconds"); + BenchmarkHandle = BenchmarkStartProcess((string)secondcommandLine); + //BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); + var secondbenchmarkTimer = new Stopwatch(); + secondbenchmarkTimer.Reset(); + secondbenchmarkTimer.Start(); + + BenchmarkProcessStatus = BenchmarkProcessStatus.Running; + BenchmarkThreadRoutineStartSettup(); //need for benchmark log + while (IsActiveProcess(BenchmarkHandle.Id)) + { + if (secondbenchmarkTimer.Elapsed.TotalSeconds >= (_benchmarkTimeWait + 60) + || BenchmarkSignalQuit + || BenchmarkSignalFinnished + || BenchmarkSignalHanged + || BenchmarkSignalTimedout + || BenchmarkException != null) + { + var imageName = MinerExeName.Replace(".exe", ""); + // maybe will have to KILL process + EndBenchmarkProcces(); + // KillMinerBase(imageName); + if (BenchmarkSignalTimedout) + { + throw new Exception("Benchmark timedout"); + } + + if (BenchmarkException != null) + { + throw BenchmarkException; + } + + if (BenchmarkSignalQuit) + { + throw new Exception("Termined by user request"); + } + + if (BenchmarkSignalFinnished) + { + break; + } + + break; + } + // wait a second due api request + Thread.Sleep(1000); + + var ad = GetSummaryAsync(); + if (ad.Result != null && ad.Result.Speed > 0) + { + repeats++; + double benchProgress = repeats / (_benchmarkTimeWait - MinerStartDelay - 15); + BenchmarkAlgorithm.BenchmarkProgressPercent = (int)(benchProgress * 100); + if (repeats > delay_before_calc_hashrate) + { + Helpers.ConsolePrint(MinerTag(), "Useful API Speed: " + ad.Result.Speed.ToString()); + summspeedSecond += ad.Result.Speed; + } + else + { + Helpers.ConsolePrint(MinerTag(), "Delayed API Speed: " + ad.Result.Speed.ToString()); + } + + if (repeats >= _benchmarkTimeWait - MinerStartDelay - 15) + { + Helpers.ConsolePrint(MinerTag(), "Benchmark ended"); + ad.Dispose(); + secondbenchmarkTimer.Stop(); + + BenchmarkHandle.Kill(); + BenchmarkHandle.Dispose(); + //EndBenchmarkProcces(); + StopDriver(); + break; + } + + } + } + BenchmarkAlgorithm.BenchmarkSecondarySpeed = Math.Round(summspeedSecond / (repeats - delay_before_calc_hashrate), 2); + } + catch (Exception ex) + { + Helpers.ConsolePrint(MinerTag(), ex.ToString()); + BenchmarkThreadRoutineCatch(ex); + } + finally + { + //BenchmarkThreadRoutineFinish(); + // find latest log file + string latestLogFile = ""; + var dirInfo = new DirectoryInfo(WorkingDirectory); + foreach (var file in dirInfo.GetFiles(GetLogFileName())) + { + latestLogFile = file.Name; + break; + } + try + { + // read file log + if (File.Exists(WorkingDirectory + latestLogFile)) + { + var lines = File.ReadAllLines(WorkingDirectory + latestLogFile); + foreach (var line in lines) + { + if (line != null) + { + CheckOutdata(line); + } + } + File.Delete(WorkingDirectory + latestLogFile); + } + } + catch (Exception ex) + { + Helpers.ConsolePrint(MinerTag(), ex.ToString()); + } + } + + } + } protected override void BenchmarkOutputErrorDataReceivedImpl(string outdata) { CheckOutdata(outdata); diff --git a/NiceHashMiner/Miners/trex.cs b/NiceHashMiner/Miners/trex.cs index a63e236f1..10cbf88a4 100644 --- a/NiceHashMiner/Miners/trex.cs +++ b/NiceHashMiner/Miners/trex.cs @@ -48,6 +48,7 @@ public override void Start(string url, string btcAdress, string worker) // url = url.Replace(".nicehash.", "-new.nicehash."); algo = algo.Replace("daggerhashimoto", "ethash"); + algo = algo.Replace("autolykos", "autolykos2"); url = url.Replace("stratum+tcp", "stratum2+tcp"); LastCommandLine = algo + " -o " + url + " -u " + username + " -p x " + @@ -136,6 +137,18 @@ protected override string BenchmarkCreateCommandLine(Algorithm algorithm, int ti commandLine += GetDevicesCommandString(); _benchmarkTimeWait = time; } + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos)) + { + commandLine = "--algo autolykos2" + + " -o stratum+tcp://pool.eu.woolypooly.com:3100" + " -u 9gnVDaLeFa4ETwtrceHepPe9JeaCBGV1PxV5tdNGAvqEmjWF2Lt.trex" + " -p x " + + " -o " + url + " -u " + username + " -p x " + + ExtraLaunchParametersParser.ParseForMiningSetup( + MiningSetup, + DeviceType.NVIDIA) + " --gpu-report-interval 1 --no-watchdog --api-bind-http 127.0.0.1:" + ApiPort + + " -d "; + commandLine += GetDevicesCommandString(); + _benchmarkTimeWait = time; + } return commandLine; } @@ -227,6 +240,11 @@ protected override void BenchmarkThreadRoutine(object commandLine) delay_before_calc_hashrate = 10; MinerStartDelay = 10; } + if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Autolykos)) + { + delay_before_calc_hashrate = 5; + MinerStartDelay = 30; + } var ad = GetSummaryAsync(); if (ad.Result != null && ad.Result.Speed > 0) diff --git a/NiceHashMiner/langs/en.lang b/NiceHashMiner/langs/en.lang index 931e40c3c..3cb96c520 100644 --- a/NiceHashMiner/langs/en.lang +++ b/NiceHashMiner/langs/en.lang @@ -423,6 +423,7 @@ "Form_Settings_checkBox_Allow_remote_management": "Allow remote management", "Form_Settings_checkBox_Send_actual_version_info": "Send actual version info", "Form_Settings_checkBox_Additional_info_about_device": "Additional info about device", + "Form_Settings_checkBox_DisplayConnected": "Show which GPU display is connected to", "Form_Settings_checkBox_show_NVdevice_manufacturer": "Show NVIDIA device manufacturer", "Form_Settings_checkBox_show_AMDdevice_manufacturer": "Show AMD device manufacturer", "Form_Settings_checkBox_show_device_memsize": "Show amount of device memory", diff --git a/NiceHashMiner/langs/ru.lang b/NiceHashMiner/langs/ru.lang index 3008f5fed..1582af140 100644 --- a/NiceHashMiner/langs/ru.lang +++ b/NiceHashMiner/langs/ru.lang @@ -492,6 +492,7 @@ "Form_Settings_uncompatible_options1": "Параметры \"Разрешить неколько экземпляров\" и \"Включить сторожевой процесс\" несовместимы", "Form_Settings_DelBenchmarks": "Это приведет к сбросу всех скоростей в алгоритмах", "Form_Settings_checkBox_Additional_info_about_device": "Дополнительная информация об устройстве", + "Form_Settings_checkBox_DisplayConnected": "Показать, к какому GPU подключен дисплей", "Form_Settings_checkBox_show_NVdevice_manufacturer": "Показывать производителей устройств NVIDIA", "Form_Settings_checkBox_show_AMDdevice_manufacturer": "Показывать производителей устройств AMD", "Form_Settings_checkBox_show_device_memsize": "Показывать объем памяти устройств",