public void SetStatus(MiningStatus _status) { /// NVIDIA \\\ // [2018-02-18 21:44:31][01;37m accepted: 1/1 (diff 0.022), 1060.33 kH/s [32myes![0m // Nvidia Regex Accepted: (?:\[[0-9-: ]+\])(?:.*)(?:accepted: )(\d+)(?:\/)(\d+)(?:.*diff )(\d+\.?\d+)(?:.*, )([\d\.]+ .+H\/s) // [2018-02-18 21:43:23] GPU #0: 1414 MHz 23.72 kH/W 44W 37C FAN 0%[0m // Nvidia Regex Regular: (?:\[[0-9-: ]+\])(?:.*GPU #)(\d+)(?:: )([\d]+.+Hz)(?: )([\d]+.+H\/W)(?: )([\d]+W)(?: )([\d]+C)(?: FAN )([\d]+%) // [2018-02-20 13:43:54][36m allium block 67129, diff 250.313[0m // Nvidia Regex Block: (?:\[[0-9-: ]+\])(?:.*allium block )(\d*)(?:.*diff )([\d\.]*) /// CPU \\\ // [2018-02-20 13:43:59] CPU #0: 39.30 kH/s[0m // (OR FOR OPT) [2018-03-02 18:40:29] CPU #2: 420.09 kH, 75.86 kH/s[0m // CPU Regex Regular: (?:\[[0-9-: ]+\])(?:.*CPU #)(\d+)(?:.+ )([\d]+.+H\/s) // [2018-02-18 21:44:31][01;37m accepted: 1/1 (diff 0.022), 1060.33 kH/s [32myes![0m // CPU Regex Accepted: (?:\[[0-9-: ]+\])(?:.*)(?:accepted: )(\d+)(?:\/)(\d+)(?:.*diff )(\d+\.?\d+)(?:.*, )([\d\.]+ .+H\/s) // [2018-02-20 13:43:56][36m allium block 67129, diff 250.313[0m // CPU Regex Block: (?:\[[0-9-: ]+\])(?:.*allium block )(\d*)(?:.*diff )([\d\.]*) status = _status; }
public void SetStatus(MiningStatus _status) { // 2018-02-18 21:44:31 | Info | Output from nvidia_win process: [2018-02-18 21:44:31][01;37m accepted: 1/1 (diff 0.022), 1060.33 kH/s [32myes![0m // Nvidia Regex Accepted: /(?:\[[0-9-: ]+\])(?:.*)(?:accepted: )(\d+)(?:\/)(\d+)(?:.*diff )(\d+\.?\d+)(?:.*, )([\d\.]+ .+H\/s)/ // 2018-02-18 21:43:23 | Info | Output from nvidia_win process: [2018-02-18 21:43:23] GPU #0: 1414 MHz 23.72 kH/W 44W 37C FAN 0%[0m // Nvidia Regex Regular: (?:\[[0-9-: ]+\])(?:.*: )([\d]+.+Hz)(?: )([\d]+.+H\/W)(?: )([\d]+W)(?: )([\d]+C)(?: FAN )([\d]+%) status = _status; }
public async Task StartMining(string address, string pool, IProgress <MiningStatus> progress) { // TODO: Add system so that each GPU has its own mining status and therefore, its own miner info MiningStatus status = new MiningStatus(); status.progress = progress; string[] minersToUse = GetMinersWithStatus(MinerStatus.Enabled); status.info = "Starting miners " + String.Join(", ", minersToUse); logger.Info(status.info); progress.Report(status); List <Task> miningTasks = new List <Task>(); for (int i = 0; i < minersToUse.Length; i++) { Miner miner = data.installed[minersToUse[i]]; // If the miner has a problem if (!(await VerifyMiner(miner))) { status.info = "Miner \"" + miner.GetID() + "\" could not be found, please try reinstalling it."; logger.Error(status.info); progress.Report(status); return; } string commandToRun = GetMinerCommand(address, pool, miner); // Setup Command Process miner.miningProcess = new Command(); miner.miningProcess.Setup(minersToUse[i], true); miner.miningProcess.SetStatus(status); // Set Status as Mining miner.status = MinerStatus.Mining; // Run the mining command miningTasks.Add(miner.miningProcess.Run(commandToRun)); // TODO: Add support for multiple GPUs to work together (GPU list by ID and get GPU type, then start Command for each of them) // TODO: Add a system to return Progress reports to display hashrate + balance + blocks mined... } status.info = "Mining..."; logger.Info(status.info); progress.Report(status); await Task.WhenAll(miningTasks); status.info = "Finished mining."; logger.Info(status.info); progress.Report(status); }
public void SetStatus(MiningStatus _status) { status = _status; }
public async Task StartMining(string address, string pool, IProgress <MiningStatus> progress) { // TODO: Add system so that each GPU has its own mining status and therefore, its own miner info MiningStatus status = new MiningStatus(); status.progress = progress; status.id = "NONE"; string[] minersToUse = GetMinersWithStatus(MinerStatus.Enabled); status.info = "Starting miners " + String.Join(", ", minersToUse); logger.Info(status.info); progress.Report(status); List <Task> miningTasks = new List <Task>(); for (int i = 0; i < minersToUse.Length; i++) { Miner miner = data.installed[minersToUse[i]]; // Custom status for the miner itself MiningStatus minerStatus = new MiningStatus(); minerStatus.progress = progress; minerStatus.id = miner.GetID(); // If the miner has a problem if (!(await VerifyMiner(miner))) { minerStatus.info = "Miner \"" + miner.GetID() + "\" could not be found, please try reinstalling it."; logger.Error(minerStatus.info); progress.Report(minerStatus); return; } string commandToRun = GetMinerCommand(address, pool, miner); // Setup Command Process miner.miningProcess = new Command(); miner.miningProcess.Setup(minersToUse[i], true); miner.miningProcess.SetStatus(minerStatus); // Setup API Connection miner.apiConnect = new APIConnect(GetAPIConnectURL(miner)); miner.apiConnect.SetStatus(minerStatus); // When miner exits, stop the API connection miner.miningProcess.onStopped = miner.apiConnect.Stop; // Set Status as Mining miner.status = MinerStatus.Mining; // Run the mining command miningTasks.Add(miner.miningProcess.Run(commandToRun)); // Start the data fetching/api connection miningTasks.Add(miner.apiConnect.SetupConnection()); } status.info = "Mining..."; logger.Info(status.info); progress.Report(status); try { await Task.WhenAll(miningTasks); } catch (Exception e) { progress.Report(new MiningStatus() { info = "Something went wrong..." }); logger.Error("Something went wrong while mining."); logger.Error(e); } status.info = "Finished mining."; logger.Info(status.info); progress.Report(status); }