Exemple #1
0
        private void StartPoolStats()
        {
            statsTimer           = new Timer(poolInstance.poolStatsIntervalInMs);
            statsTimer.AutoReset = true;

            statsTimer.Elapsed += delegate
            {
                if (IsPoolConnectionRequired() == false)
                {
                    return;
                }

                string hashPrint = minerManager.GetCurrentHashrateReadable();

                if (hashPrint.Length > 0)
                {
                    hashPrint = "Hashrate: " + hashPrint;
                }

                TimeSpan time = poolInstance.poolConnectedTime - DateTime.Now;
                Log.Information("[{0}] {1} Miners: {2} Shares: {3}/{4}/{5} {6}",
                                this.poolWorkerName, time.ToString("hh\\:mm"), minerManager.ConnectedMiners,
                                poolInstance.submittedSharesCount, poolInstance.acceptedSharesCount,
                                poolInstance.rejectedSharesCount, hashPrint);

                lock (minerManager.MinerManagerLock)
                {
                    //Serilog.Log.Information(string.Format("{0, -10} {1, 6} {2, 6} {3, 6} {4, -15}", "MINER", "SUBMIT", "ACCEPT", "REJECT", "HASHRATE"));
                    //Serilog.Log.Information(string.Format("{0, -10} {1, 6} {2, 6} {3, 6} {4, -15}", "-----", "------", "------", "------", "--------"));
                    minerManager.GetMinerList().ForEach <Miner>(m => m.PrintShares(poolWorkerName));
                }
                poolHandler.DoSendHashrate(this);
            };

            statsTimer.Start();
        }