Exemplo n.º 1
0
        public void SetStatus(MiningStatus _status)
        {
            ///  NVIDIA \\\
            // [2018-02-18 21:44:31] accepted: 1/1 (diff 0.022), 1060.33 kH/s yes!
            // 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%
            // Nvidia Regex Regular: (?:\[[0-9-: ]+\])(?:.*GPU #)(\d+)(?:: )([\d]+.+Hz)(?: )([\d]+.+H\/W)(?: )([\d]+W)(?: )([\d]+C)(?: FAN )([\d]+%)

            // [2018-02-20 13:43:54] allium block 67129, diff 250.313
            // Nvidia Regex Block: (?:\[[0-9-: ]+\])(?:.*allium block )(\d*)(?:.*diff )([\d\.]*)

            /// CPU \\\
            // [2018-02-20 13:43:59] CPU #0: 39.30 kH/s
            // (OR FOR OPT) [2018-03-02 18:40:29] CPU #2: 420.09 kH, 75.86 kH/s
            // CPU Regex Regular: (?:\[[0-9-: ]+\])(?:.*CPU #)(\d+)(?:.+ )([\d]+.+H\/s)

            // [2018-02-18 21:44:31] accepted: 1/1 (diff 0.022), 1060.33 kH/s yes!
            // CPU Regex Accepted: (?:\[[0-9-: ]+\])(?:.*)(?:accepted: )(\d+)(?:\/)(\d+)(?:.*diff )(\d+\.?\d+)(?:.*, )([\d\.]+ .+H\/s)

            // [2018-02-20 13:43:56] allium block 67129, diff 250.313
            // CPU Regex Block: (?:\[[0-9-: ]+\])(?:.*allium block )(\d*)(?:.*diff )([\d\.]*)

            status = _status;
        }
Exemplo n.º 2
0
        public void SetStatus(MiningStatus _status)
        {
            // 2018-02-18 21:44:31 | Info | Output from nvidia_win process: [2018-02-18 21:44:31] accepted: 1/1 (diff 0.022), 1060.33 kH/s yes!
            // 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%
            // Nvidia Regex Regular: (?:\[[0-9-: ]+\])(?:.*: )([\d]+.+Hz)(?: )([\d]+.+H\/W)(?: )([\d]+W)(?: )([\d]+C)(?: FAN )([\d]+%)
            status = _status;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public void SetStatus(MiningStatus _status)
 {
     status = _status;
 }
Exemplo n.º 5
0
        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);
        }