public static void PopulateFrom(this MiningStatistics miningStatistics, DeviceInformationResponse deviceInformation)
 {
     miningStatistics.AcceptedShares = deviceInformation.AcceptedShares;
     miningStatistics.AverageHashrate = deviceInformation.AverageHashrate;
     miningStatistics.CurrentHashrate = deviceInformation.CurrentHashrate;
     miningStatistics.Enabled = deviceInformation.Enabled;
     miningStatistics.FanPercent = deviceInformation.FanPercent;
     miningStatistics.FanSpeed = deviceInformation.FanSpeed;
     miningStatistics.GpuActivity = deviceInformation.GpuActivity;
     miningStatistics.GpuClock = deviceInformation.GpuClock;
     miningStatistics.GpuVoltage = deviceInformation.GpuVoltage;
     miningStatistics.HardwareErrors = deviceInformation.HardwareErrors;
     miningStatistics.Index = deviceInformation.Index;
     miningStatistics.Intensity = deviceInformation.Intensity;
     miningStatistics.Kind = deviceInformation.Kind;
     miningStatistics.MemoryClock = deviceInformation.MemoryClock;
     miningStatistics.PowerTune = deviceInformation.PowerTune;
     miningStatistics.RejectedShares = deviceInformation.RejectedShares;
     miningStatistics.Status = deviceInformation.Status;
     miningStatistics.Temperature = deviceInformation.Temperature;
     //new properties from bfgminer
     miningStatistics.Name = deviceInformation.Name;
     miningStatistics.DeviceID = deviceInformation.ID;
     miningStatistics.PoolIndex = deviceInformation.PoolIndex;
     //miningStatistics.PoolName = deviceInformation.PoolName;
     miningStatistics.RejectedSharesPercent = deviceInformation.RejectedSharesPercent;
     miningStatistics.HardwareErrorsPercent = deviceInformation.HardwareErrorsPercent;
 }
Exemple #2
0
        private void PopulateMiningStatistics(MultiMiner.MobileMiner.Api.MiningStatistics miningStatistics, DeviceInformationResponse deviceInformation,
            string coinName)
        {
            miningStatistics.MinerName = "MultiMiner";
            miningStatistics.CoinName = coinName;
            CoinConfiguration coinConfiguration = engineConfiguration.CoinConfigurations.Single(c => c.Coin.Name.Equals(coinName));
            CryptoCoin coin = coinConfiguration.Coin;
            miningStatistics.CoinSymbol = coin.Symbol;

            if (coin.Algorithm == CoinAlgorithm.Scrypt)
                miningStatistics.Algorithm = "scrypt";
            else if (coin.Algorithm == CoinAlgorithm.SHA256)
                miningStatistics.Algorithm = "SHA-256";

            miningStatistics.PopulateFrom(deviceInformation);
        }
Exemple #3
0
        private void PopulateDeviceStatsForListViewItem(DeviceInformationResponse deviceInformation, ListViewItem item)
        {
            deviceListView.BeginUpdate();
            try
            {
                //stratum devices get lumped together, so we sum those
                if (deviceInformation.Name.Equals("PXY", StringComparison.OrdinalIgnoreCase))
                {
                    item.SubItems["Hashrate"].Tag = (double)(item.SubItems["Hashrate"].Tag ?? 0.00) + deviceInformation.AverageHashrate;
                    item.SubItems["Rejected"].Tag = (double)(item.SubItems["Rejected"].Tag ?? 0.00) + deviceInformation.RejectedSharesPercent;
                    item.SubItems["Errors"].Tag = (double)(item.SubItems["Errors"].Tag ?? 0.00) + deviceInformation.HardwareErrorsPercent;
                    item.SubItems["Accepted"].Tag = (int)(item.SubItems["Accepted"].Tag ?? 0) + deviceInformation.AcceptedShares;
                    item.SubItems["Utility"].Tag = (double)(item.SubItems["Utility"].Tag ?? 0.00) + deviceInformation.Utility;
                }
                else
                {
                    item.SubItems["Hashrate"].Tag = deviceInformation.AverageHashrate;
                    item.SubItems["Rejected"].Tag = deviceInformation.RejectedSharesPercent;
                    item.SubItems["Errors"].Tag = deviceInformation.HardwareErrorsPercent;
                    item.SubItems["Accepted"].Tag = deviceInformation.AcceptedShares;
                    item.SubItems["Utility"].Tag = deviceInformation.Utility;
                }

                item.SubItems["Hashrate"].Text = ((double)item.SubItems["Hashrate"].Tag).ToHashrateString();

                //check for >= 0.05 so we don't show 0% (due to the format string)
                item.SubItems["Rejected"].Text = (double)item.SubItems["Rejected"].Tag >= 0.05 ? ((double)item.SubItems["Rejected"].Tag).ToString("0.#") + "%" : String.Empty;
                item.SubItems["Errors"].Text = (double)item.SubItems["Errors"].Tag >= 0.05 ? ((double)item.SubItems["Errors"].Tag).ToString("0.#") + "%" : String.Empty;

                item.SubItems["Accepted"].Text = (int)item.SubItems["Accepted"].Tag > 0 ? ((int)item.SubItems["Accepted"].Tag).ToString() : String.Empty;

                item.SubItems["Utility"].Text = (double)item.SubItems["Utility"].Tag >= 0.00 ? ((double)item.SubItems["Utility"].Tag).ToString("0.###") : String.Empty;

                item.SubItems["Temp"].Text = deviceInformation.Temperature > 0 ? deviceInformation.Temperature + "°" : String.Empty;
                item.SubItems["Fan"].Text = deviceInformation.FanPercent > 0 ? deviceInformation.FanPercent + "%" : String.Empty;
                item.SubItems["Intensity"].Text = deviceInformation.Intensity;

                PopulatePoolForListViewItem(deviceInformation.PoolIndex, item);

                PopulateIncomeForListViewItem(item);
            }
            finally
            {
                deviceListView.EndUpdate();
            }
        }
Exemple #4
0
        private void FlagSuspiciousMiner(MinerProcess minerProcess, DeviceInformationResponse deviceInformation)
        {
            if (deviceInformation.Status.ToLower().Contains("sick"))
                minerProcess.HasSickDevice = true;
            if (deviceInformation.Status.ToLower().Contains("dead"))
                minerProcess.HasDeadDevice = true;
            if (deviceInformation.CurrentHashrate == 0)
                minerProcess.HasZeroHashrateDevice = true;

            //don't check average hashrate if using dynamic intensity and its a GPU
            if (!engineConfiguration.XgminerConfiguration.DesktopMode ||
                (!deviceInformation.Kind.Equals("GPU", StringComparison.OrdinalIgnoreCase)))
            {
                //avoid div by 0
                if (deviceInformation.AverageHashrate > 0)
                {
                    double performanceRatio = deviceInformation.CurrentHashrate / deviceInformation.AverageHashrate;
                    if (performanceRatio <= 0.50)
                        minerProcess.HasPoorPerformingDevice = true;
                }
            }
        }
        public static void ParseTextForDeviceInformation(string text, List<DeviceInformationResponse> deviceInformation)
        {
            List<string> deviceBlob = text.Split('|').ToList();
            deviceBlob.RemoveAt(0);

            foreach (string deviceText in deviceBlob)
            {
                if (deviceText == "\0")
                    continue;

                //bfgminer may have multiple entries for the same key, e.g. Hardware Errors
                //seen with customer data/hardware
                //remove dupes using Distinct()
                var deviceAttributes = deviceText.Split(',').ToList().Distinct();

                Dictionary<string, string> keyValuePairs = deviceAttributes
                  .Where(value => value.Contains('='))
                  .Select(value => value.Split('='))
                  .ToDictionary(pair => pair[0], pair => pair[1]);

                //seen Count == 0 with user API logs
                if (keyValuePairs.Count > 0)
                {
                    DeviceInformationResponse newDevice = new DeviceInformationResponse();

                    newDevice.Kind = keyValuePairs.ElementAt(0).Key;

                    newDevice.Index = TryToParseInt(keyValuePairs, newDevice.Kind, -1);
                    if (newDevice.Index == -1)
                        continue;

                    if (keyValuePairs.ContainsKey("Enabled")) //seen this needed with a user
                        newDevice.Enabled = keyValuePairs["Enabled"].Equals("Y");

                    if (keyValuePairs.ContainsKey("Status")) //check required for bfgminer
                        newDevice.Status = keyValuePairs["Status"];

                    if (keyValuePairs.ContainsKey("Name"))
                        newDevice.Name = keyValuePairs["Name"];
                    else
                        //default to Kind for older RPC API versions
                        newDevice.Name = newDevice.Kind;

                    //default to Index for older RPC API versions
                    newDevice.ID = newDevice.Index;
                    if (keyValuePairs.ContainsKey("ID"))
                        newDevice.ID = TryToParseInt(keyValuePairs, "ID", newDevice.Index);

                    //parse regardless of device type = ASICs may have Temp
                    newDevice.Temperature = TryToParseDouble(keyValuePairs, "Temperature", 0.00);
                    newDevice.FanSpeed = TryToParseInt(keyValuePairs, "Fan Speed", 0);
                    newDevice.FanPercent = TryToParseInt(keyValuePairs, "Fan Percent", 0);
                    newDevice.GpuClock = TryToParseInt(keyValuePairs, "GPU Clock", 0);
                    newDevice.MemoryClock = TryToParseInt(keyValuePairs, "Memory Clock", 0);
                    newDevice.GpuVoltage = TryToParseDouble(keyValuePairs, "GPU Voltage", 0.00);
                    newDevice.GpuActivity = TryToParseInt(keyValuePairs, "GPU Activity", 0);
                    newDevice.PowerTune = TryToParseInt(keyValuePairs, "Powertune", 0);
                    if (keyValuePairs.ContainsKey("Intensity")) //check required for bfgminer 3.3.0
                        newDevice.Intensity = keyValuePairs["Intensity"];

                    newDevice.AverageHashrate = TryToParseDouble(keyValuePairs, "MHS av", 0.00) * 1000;

                    //seen both MHS 5s and MHS 1s
                    if (keyValuePairs.ContainsKey("MHS 5s"))
                        newDevice.CurrentHashrate = TryToParseDouble(keyValuePairs, "MHS 5s", 0.00) * 1000;
                    else if (keyValuePairs.ContainsKey("MHS 1s"))
                        newDevice.CurrentHashrate = TryToParseDouble(keyValuePairs, "MHS 1s", 0.00) * 1000;

                    newDevice.AcceptedShares = TryToParseInt(keyValuePairs, "Accepted", 0);
                    newDevice.RejectedShares = TryToParseInt(keyValuePairs, "Rejected", 0);
                    newDevice.HardwareErrors = TryToParseInt(keyValuePairs, "Hardware Errors", 0);
                    newDevice.Utility = TryToParseDouble(keyValuePairs, "Utility", 0.00);
                    newDevice.WorkUtility = TryToParseDouble(keyValuePairs, "Work Utility", 0.00);
                    newDevice.PoolIndex = TryToParseInt(keyValuePairs, "Last Share Pool", -1);
                    newDevice.HardwareErrorsPercent = TryToParseDouble(keyValuePairs, "Device Hardware%", 0.00);
                    newDevice.RejectedSharesPercent = TryToParseDouble(keyValuePairs, "Device Rejected%", 0.00);

                    deviceInformation.Add(newDevice);
                }
            }
        }
Exemple #6
0
        private void PopulateDeviceStatsForListViewItem(DeviceInformationResponse deviceInformation, ListViewItem item)
        {
            deviceListView.BeginUpdate();
            try
            {
                //stratum devices get lumped together, so we sum those
                if (deviceInformation.Name.Equals("PXY", StringComparison.OrdinalIgnoreCase))
                {
                    item.SubItems["Average"].Tag = (double)(item.SubItems["Average"].Tag ?? 0.00) + deviceInformation.AverageHashrate;
                    item.SubItems["Current"].Tag = (double)(item.SubItems["Current"].Tag ?? 0.00) + deviceInformation.CurrentHashrate;
                    item.SubItems["Effective"].Tag = (double)(item.SubItems["Effective"].Tag ?? 0.00) + deviceInformation.WorkUtility;
                    item.SubItems["Rejected"].Tag = (double)(item.SubItems["Rejected"].Tag ?? 0.00) + deviceInformation.RejectedSharesPercent;
                    item.SubItems["Errors"].Tag = (double)(item.SubItems["Errors"].Tag ?? 0.00) + deviceInformation.HardwareErrorsPercent;
                    item.SubItems["Accepted"].Tag = (int)(item.SubItems["Accepted"].Tag ?? 0) + deviceInformation.AcceptedShares;

                    if (applicationConfiguration.ShowWorkUtility)
                        item.SubItems[utilityColumnHeader.Text].Tag = (double)(item.SubItems[utilityColumnHeader.Text].Tag ?? 0.00) + deviceInformation.WorkUtility;
                    else
                        item.SubItems[utilityColumnHeader.Text].Tag = (double)(item.SubItems[utilityColumnHeader.Text].Tag ?? 0.00) + deviceInformation.Utility;
                }
                else
                {
                    item.SubItems["Average"].Tag = deviceInformation.AverageHashrate;
                    item.SubItems["Current"].Tag = deviceInformation.CurrentHashrate;
                    item.SubItems["Effective"].Tag = deviceInformation.WorkUtility;
                    item.SubItems["Rejected"].Tag = deviceInformation.RejectedSharesPercent;
                    item.SubItems["Errors"].Tag = deviceInformation.HardwareErrorsPercent;
                    item.SubItems["Accepted"].Tag = deviceInformation.AcceptedShares;

                    if (applicationConfiguration.ShowWorkUtility)
                        item.SubItems[utilityColumnHeader.Text].Tag = deviceInformation.WorkUtility;
                    else
                        item.SubItems[utilityColumnHeader.Text].Tag = deviceInformation.Utility;
                }

                item.SubItems["Average"].Text = ((double)item.SubItems["Average"].Tag).ToHashrateString();
                item.SubItems["Current"].Text = ((double)item.SubItems["Current"].Tag).ToHashrateString();

                //this will be wrong for Scrypt until 3.10.1
                double shaMultiplier = 71582788 / 1000;
                double workUtility = (double)item.SubItems["Effective"].Tag;
                double hashrate = workUtility * shaMultiplier;

                item.SubItems["Effective"].Text = hashrate.ToHashrateString();

                //check for >= 0.05 so we don't show 0% (due to the format string)
                item.SubItems["Rejected"].Text = (double)item.SubItems["Rejected"].Tag >= 0.05 ? ((double)item.SubItems["Rejected"].Tag).ToString("0.#") + "%" : String.Empty;
                item.SubItems["Errors"].Text = (double)item.SubItems["Errors"].Tag >= 0.05 ? ((double)item.SubItems["Errors"].Tag).ToString("0.#") + "%" : String.Empty;

                item.SubItems["Accepted"].Text = (int)item.SubItems["Accepted"].Tag > 0 ? ((int)item.SubItems["Accepted"].Tag).ToString() : String.Empty;

                item.SubItems[utilityColumnHeader.Text].Text = (double)item.SubItems[utilityColumnHeader.Text].Tag >= 0.00 ? ((double)item.SubItems[utilityColumnHeader.Text].Tag).ToString("0.###") : String.Empty;

                item.SubItems["Temp"].Text = deviceInformation.Temperature > 0 ? deviceInformation.Temperature + "°" : String.Empty;
                item.SubItems["Fan"].Text = deviceInformation.FanPercent > 0 ? deviceInformation.FanPercent + "%" : String.Empty;
                item.SubItems["Intensity"].Text = deviceInformation.Intensity;

                PopulatePoolForListViewItem(deviceInformation.PoolIndex, item);

                PopulateIncomeForListViewItem(item);
            }
            finally
            {
                deviceListView.EndUpdate();
            }
        }
Exemple #7
0
        private void PopulateDeviceInfoForRow(DeviceInformationResponse deviceInformation, DataGridViewRow row)
        {
            //stratum devices get lumped together, so we sum those
            if (deviceInformation.Name.Equals("PXY", StringComparison.OrdinalIgnoreCase))
            {
                row.Cells[hashRateColumn.Index].Value = (double)(row.Cells[hashRateColumn.Index].Value ?? 0.00) + deviceInformation.AverageHashrate;
                row.Cells[acceptedColumn.Index].Value = (int)(row.Cells[acceptedColumn.Index].Value ?? 0) + deviceInformation.AcceptedShares;
                row.Cells[rejectedColumn.Index].Value = (int)(row.Cells[rejectedColumn.Index].Value ?? 0) + deviceInformation.RejectedShares;
                row.Cells[errorsColumn.Index].Value = (int)(row.Cells[errorsColumn.Index].Value ?? 0) + deviceInformation.HardwareErrors;
                row.Cells[utilityColumn.Index].Value = (double)(row.Cells[utilityColumn.Index].Value ?? 0.00) + deviceInformation.Utility;
            }
            else
            {
                row.Cells[hashRateColumn.Index].Value = deviceInformation.AverageHashrate;
                row.Cells[acceptedColumn.Index].Value = deviceInformation.AcceptedShares;
                row.Cells[rejectedColumn.Index].Value = deviceInformation.RejectedShares;
                row.Cells[errorsColumn.Index].Value = deviceInformation.HardwareErrors;
                row.Cells[utilityColumn.Index].Value = deviceInformation.Utility;
            }

            row.Cells[temperatureColumn.Index].Value = deviceInformation.Temperature;
            row.Cells[intensityColumn.Index].Value = deviceInformation.Intensity;
            PopulatePoolForRow(deviceInformation.PoolIndex, row);
        }
Exemple #8
0
 private static void PopulateMiningStatsFromDeviceInfo(MobileMiner.Api.MiningStatistics miningStatistics, DeviceInformationResponse deviceInformation)
 {
     miningStatistics.AcceptedShares = deviceInformation.AcceptedShares;
     miningStatistics.AverageHashrate = deviceInformation.AverageHashrate;
     miningStatistics.CurrentHashrate = deviceInformation.CurrentHashrate;
     miningStatistics.Enabled = deviceInformation.Enabled;
     miningStatistics.FanPercent = deviceInformation.FanPercent;
     miningStatistics.FanSpeed = deviceInformation.FanSpeed;
     miningStatistics.GpuActivity = deviceInformation.GpuActivity;
     miningStatistics.GpuClock = deviceInformation.GpuClock;
     miningStatistics.GpuVoltage = deviceInformation.GpuVoltage;
     miningStatistics.HardwareErrors = deviceInformation.HardwareErrors;
     miningStatistics.Index = deviceInformation.Index;
     miningStatistics.Intensity = deviceInformation.Intensity;
     miningStatistics.Kind = deviceInformation.Kind;
     miningStatistics.MemoryClock = deviceInformation.MemoryClock;
     miningStatistics.PowerTune = deviceInformation.PowerTune;
     miningStatistics.RejectedShares = deviceInformation.RejectedShares;
     miningStatistics.Status = deviceInformation.Status;
     miningStatistics.Temperature = deviceInformation.Temperature;
     miningStatistics.Utility = deviceInformation.Utility;
 }
Exemple #9
0
        private int GetRowIndexForDeviceInformation(DeviceInformationResponse deviceInformation)
        {
            int index = 0;
            int rowIndex = -1;

            for (int i = 0; i < devices.Count; i++)
            {
                if ((deviceInformation.Kind.Equals("GPU") && (devices[i].Kind == DeviceKind.GPU))
                    || (deviceInformation.Name.Equals("PXY") && (devices[i].Kind == DeviceKind.PXY))
                    || (!deviceInformation.Kind.Equals("GPU") && !deviceInformation.Name.Equals("PXY") && (devices[i].Kind != DeviceKind.GPU) && (devices[i].Kind != DeviceKind.GPU)))
                {
                    if ((index == deviceInformation.Index)
                        //for now all proxy devices will show under a single PXY device in MultiMiner
                        || (devices[i].Kind == DeviceKind.PXY))
                    {
                        rowIndex = i;
                        break;
                    }
                    index++;
                }
            }

            return rowIndex;
        }
        public DeviceViewModel ApplyDeviceInformationResponseModel(Device deviceModel, DeviceInformationResponse deviceInformationResponseModel)
        {
            DeviceViewModel deviceViewModel = Devices.SingleOrDefault(d => d.Equals(deviceModel));
            if (deviceViewModel != null)
            {
                if (deviceModel.Kind == DeviceKind.PXY)
                {
                    deviceViewModel.PoolIndex = deviceInformationResponseModel.PoolIndex;

                    //we will get multiple deviceInformationResponseModels for the same deviceModel in the case of a Stratum Proxy
                    //bfgminer will report back for each Proxy Worker, but we only show a single entry in the ViewModel that rolls
                    //up the stats for individual Proxy Workers
                    deviceViewModel.AverageHashrate += deviceInformationResponseModel.AverageHashrate;
                    deviceViewModel.CurrentHashrate += deviceInformationResponseModel.AverageHashrate;
                    deviceViewModel.AcceptedShares += deviceInformationResponseModel.AcceptedShares;
                    deviceViewModel.RejectedShares += deviceInformationResponseModel.RejectedShares;
                    deviceViewModel.HardwareErrors += deviceInformationResponseModel.HardwareErrors;
                    deviceViewModel.Utility += deviceInformationResponseModel.Utility;
                    deviceViewModel.WorkUtility += deviceInformationResponseModel.WorkUtility;
                    deviceViewModel.RejectedSharesPercent += deviceInformationResponseModel.RejectedSharesPercent;
                    deviceViewModel.HardwareErrorsPercent += deviceInformationResponseModel.HardwareErrorsPercent;

                    //now add as a worker
                    DeviceViewModel workerViewModel = new DeviceViewModel();
                    ObjectCopier.CopyObject(deviceInformationResponseModel, workerViewModel, "Name", "Kind");
                    deviceViewModel.Workers.Add(workerViewModel);
                }
                else
                {
                    ObjectCopier.CopyObject(deviceInformationResponseModel, deviceViewModel, "Name", "Kind");
                }
            }
            return deviceViewModel;
        }