Пример #1
0
        public void UpdateLogs(HashSet <GpuLogger.Benchmark.HashEntry> hashLogs)
        {
            List <UserFriendlyHashEntry>         userFriendlyHashEntries = new List <UserFriendlyHashEntry>(hashLogs.Count);
            List <GpuLogger.Benchmark.HashEntry> sortedHashLogs          = hashLogs.OrderByDescending(entry => entry.TimeStamp).ToList();

            // If over 9000, just use max size, else make sure it doesn't get out of index
            int max = _rows > 9000? sortedHashLogs.Count : sortedHashLogs.Count < _rows ? sortedHashLogs.Count : _rows;

            for (int index = 0; index < max; index++)
            {
                GpuLogger.Benchmark.HashEntry hashEntry             = sortedHashLogs[index];
                UserFriendlyHashEntry         userFriendlyHashEntry = new UserFriendlyHashEntry
                {
                    TimeStamp =
                        GuiHelper.UnixTimeStampToDateTime(hashEntry.TimeStamp).ToString(CultureInfo.InvariantCulture),
                    HashRate   = GuiHelper.GetRightMagnitude(hashEntry.HashRate, "H"),
                    HashCount  = GuiHelper.GetRightMagnitude(hashEntry.HashCount),
                    Found      = String.Format("{0:0}", hashEntry.Found),
                    Height     = String.Format("{0:0}", hashEntry.Height),
                    Difficulty = hashEntry.Difficulty.ToString(CultureInfo.InvariantCulture)
                };

                userFriendlyHashEntries.Add(userFriendlyHashEntry);
            }

            dgvHashLogs.DataSource = new SortableBindingList <UserFriendlyHashEntry>(userFriendlyHashEntries);
        }
Пример #2
0
        public void UpdateLogs(List <GpuLogger.Benchmark.SensorValue> sensorLog)
        {
            List <UserFriendlySensorValue>         userFriendlySensorValues = new List <UserFriendlySensorValue>(sensorLog.Count);
            List <GpuLogger.Benchmark.SensorValue> sortedSensorLog          = sensorLog.OrderByDescending(value => value.TimeStamp).ToList();

            // If over 9000, just use max size, else make sure it doesn't get out of index
            int max = _rows > 9000 ? sortedSensorLog.Count : sortedSensorLog.Count < _rows ? sortedSensorLog.Count : _rows;

            for (int index = 0; index < max; index++)
            {
                GpuLogger.Benchmark.SensorValue sensorValue             = sortedSensorLog[index];
                UserFriendlySensorValue         userFriendlySensorValue = new UserFriendlySensorValue
                {
                    TimeStamp =
                        GuiHelper.UnixTimeStampToDateTime(sensorValue.TimeStamp).ToString(CultureInfo.InvariantCulture),
                    Temperature          = sensorValue.Temperature.ToString(CultureInfo.InvariantCulture) + "°C",
                    FanPercentage        = sensorValue.FanPercentage.ToString(CultureInfo.InvariantCulture) + " %",
                    FanRpm               = sensorValue.FanRpm.ToString(CultureInfo.InvariantCulture),
                    CoreClockFrequency   = GuiHelper.GetRightMagnitude(sensorValue.CoreClockFrequency, "Hz"),
                    MemoryClockFrequency = GuiHelper.GetRightMagnitude(sensorValue.MemoryClockFrequency, "Hz"),
                    ShareAnswerPing      = sensorValue.ShareAnswerPing.ToString(CultureInfo.InvariantCulture) + " ms",
                    MiningUrlPing        = sensorValue.MiningUrlPing.ToString(CultureInfo.InvariantCulture) + " ms",
                    NetworkRigPing       = sensorValue.NetworkRigPing.ToString(CultureInfo.InvariantCulture) + " ms",
                };

                userFriendlySensorValues.Add(userFriendlySensorValue);
            }

            dgvSensorLogs.DataSource = new SortableBindingList <UserFriendlySensorValue>(userFriendlySensorValues);
        }
Пример #3
0
        private void UpdateSpread(GpuLogger.Benchmark benchmark)
        {
            if (benchmark.CurrentStatistic == null)
            {
                return;
            }
            GpuLogger.Benchmark.GpuStat        statistic      = benchmark.CurrentStatistic;
            GpuLogger.Benchmark.OrderedHashLog orderedHashLog = benchmark.OrderedHashLogs ?? new GpuLogger.Benchmark.OrderedHashLog();

            dgvSpread.Rows.Clear();
            dgvSpread.Rows.Add("Average hashrate", GuiHelper.GetRightMagnitude(statistic.HarmonicAverageHashRate, "H"));
            dgvSpread.Rows.Add("Standard deviation", GuiHelper.GetRightMagnitude(statistic.StandardDeviation, "H"));
            if (statistic.AbsoluteDeviations != null)
            {
                dgvSpread.Rows.Add("MAD", GuiHelper.GetRightMagnitude(statistic.AbsoluteDeviations[0][0], "H"));
            }
            dgvSpread.Rows.Add("Interquartile range", GuiHelper.GetRightMagnitude(statistic.InterquartileRange, "H"));
            dgvSpread.Rows.Add("Highest hashrate", GuiHelper.GetRightMagnitude(statistic.HighestHashRate, "H"));
            if (statistic.Percentiles != null)
            {
                dgvSpread.Rows.Add("Real +2σ", GuiHelper.GetRightMagnitude(statistic.Percentiles["+2σ"], "H"));
                dgvSpread.Rows.Add("Real +1σ", GuiHelper.GetRightMagnitude(statistic.Percentiles["+1σ"], "H"));
                dgvSpread.Rows.Add("Real 0σ (median)", GuiHelper.GetRightMagnitude(statistic.Percentiles["0σ"], "H"));
                dgvSpread.Rows.Add("Real -1σ", GuiHelper.GetRightMagnitude(statistic.Percentiles["-1σ"], "H"));
                dgvSpread.Rows.Add("Real -2σ", GuiHelper.GetRightMagnitude(statistic.Percentiles["-2σ"], "H"));

                chartSpread.Series["BoxPlotSeries"].Points.Clear();
                chartSpread.Series["BoxPlotSeries"].Points.Add(GetBoxPlotValues(statistic, orderedHashLog));
            }
            dgvSpread.Rows.Add("Lowest hashrate", GuiHelper.GetRightMagnitude(statistic.LowestHashRate, "H"));
        }
Пример #4
0
        private void UpdateGui()
        {
            lstGeneralOverview.BeginUpdate();
            // Grabs all the selected items in the General Overview List
            int[] selectedIndexes = new int[lstGeneralOverview.SelectedIndices.Count];
            if (lstGeneralOverview.SelectedIndices.Count > 0)
            {
                for (int i = 0; i < selectedIndexes.Length; i++)
                {
                    selectedIndexes[i] = lstGeneralOverview.SelectedIndices[i];
                }
            }

            // Completely refresh the General Overview List
            lstGeneralOverview.Items.Clear();
            lstGeneralOverview.Groups.Clear();

            foreach (RigController.Rig rig in _controller.RigLogs)
            {
                // Makes sure all rigs that are in the logs are shown in RigStats
                // And updates them
                bool tabPageExists = false;
                foreach (TabPage tabPage in tbcMonitor.TabPages)
                {
                    if (tabPage.Text == rig.UserFriendlyName)
                    {
                        tabPageExists = true;
                    }

                    foreach (object control in tabPage.Controls)
                    {
                        RigTab rigTab = control as RigTab;
                        if (rigTab != null)
                        {
                            rigTab.UpdateGui();
                        }
                    }
                }

                if (!tabPageExists)
                {
                    // Makes new tabpage in rigstats
                    TabPage tabPage = new TabPage(rig.UserFriendlyName);
                    RigTab  rigTab  = new RigTab(rig)
                    {
                        Dock = DockStyle.Fill
                    };
                    rigTab.UpdateGui();
                    tabPage.Controls.Add(rigTab);
                    tabPage.Dock = DockStyle.Fill;
                    tbcMonitor.TabPages.Add(tabPage);
                }


                // Adds the controller info to the listview
                ListViewGroup lvg = new ListViewGroup(rig.UserFriendlyName);
                lstGeneralOverview.Groups.Add(lvg);

                ListViewItem lvi;
                foreach (GpuLogger gpu in rig.GpuLogs)
                {
                    lvi = new ListViewItem(gpu.Info.MinerMap.ToString(CultureInfo.InvariantCulture), lvg);
                    if (gpu.CurrentBenchmark.AvailableTimeStamps.Count == 0 || gpu.CurrentBenchmark.AvailableTimeStamps.Last().Available == false)
                    {
                        lvi.BackColor = Color.FromArgb(100, Color.Red);
                    }
                    lvi.SubItems.Add(gpu.Info.Name);
                    lvi.SubItems.Add(string.Empty);
                    if (gpu.CurrentBenchmark == null || gpu.CurrentBenchmark.CurrentStatistic == null)
                    {
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                    }
                    else
                    {
                        lvi.SubItems.Add(GuiHelper.GetRightMagnitude(gpu.CurrentBenchmark.CurrentStatistic.HarmonicAverageHashRate, "H"));
                        lvi.SubItems.Add(GuiHelper.GetRightMagnitude(gpu.CurrentBenchmark.CurrentStatistic.StandardDeviation, "H"));
                        lvi.SubItems.Add(GuiHelper.GetRightMagnitude(gpu.CurrentBenchmark.CurrentStatistic.TotalHashCount));
                        lvi.SubItems.Add(gpu.CurrentBenchmark.CurrentStatistic.Founds.ToString(CultureInfo.InvariantCulture));
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(string.Empty);
                        lvi.SubItems.Add(gpu.CurrentBenchmark.SensorLog[gpu.CurrentBenchmark.SensorLog.Count - 1]
                                         .Temperature.ToString(CultureInfo.InvariantCulture) + " °C");
                    }
                    lvi.SubItems.Add(string.Empty);
                    lstGeneralOverview.Items.Add(lvi);
                }

                lvi = new ListViewItem(string.Empty, lvg);
                lvi.SubItems.Add("Total");
                if (rig.CurrentStatistic == null)
                {
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(string.Empty);
                }
                else
                {
                    lvi.SubItems.Add(rig.CurrentStatistic.Algorithm);
                    lvi.SubItems.Add(GuiHelper.GetRightMagnitude(rig.CurrentStatistic.TotalHashRate, "H"));
                    lvi.SubItems.Add(GuiHelper.GetRightMagnitude(rig.CurrentStatistic.TotalStandardDeviation, "H"));
                    lvi.SubItems.Add(GuiHelper.GetRightMagnitude(rig.CurrentStatistic.TotalHashCount));
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(rig.CurrentStatistic.Accepts.ToString(CultureInfo.InvariantCulture));
                    lvi.SubItems.Add(rig.CurrentStatistic.Rejects.ToString(CultureInfo.InvariantCulture));
                    lvi.SubItems.Add(string.Empty);
                    lvi.SubItems.Add(rig.CurrentStatistic.ShareAnswerPing.ToString(CultureInfo.InvariantCulture));
                }

                lstGeneralOverview.Items.Add(lvi);
            }

            // Restores all the previously selected items in the General Overview List
            if (lstGeneralOverview.Items.Count > 0)
            {
                foreach (int selectedIndex in selectedIndexes)
                {
                    lstGeneralOverview.Items[selectedIndex].Selected = true;
                    lstGeneralOverview.Select();
                }
            }
            lstGeneralOverview.EndUpdate();
        }
Пример #5
0
        private void UpdateTextBoxes(GpuLogger.Benchmark benchmark)
        {
            if (!txtGpuName.Focused)
            {
                txtGpuName.Text = GpuInfo.Name;
            }
            if (!txtMinerId.Focused)
            {
                txtMinerId.Text = GpuInfo.MinerMap.ToString(CultureInfo.InvariantCulture);
            }
            if (!txtBusId.Focused)
            {
                txtBusId.Text = GpuInfo.Bus.ToString(CultureInfo.InvariantCulture);
            }
            if (!txtNvapiId.Focused)
            {
                txtNvapiId.Text = GpuInfo.NvapiId.ToString(CultureInfo.InvariantCulture);
            }
            if (!txtNvmlId.Focused)
            {
                txtNvmlId.Text = GpuInfo.NvmlId.ToString(CultureInfo.InvariantCulture);
            }
            if (!txtComputeCapability.Focused)
            {
                txtComputeCapability.Text =
                    GpuInfo.ComputeCapability.ToString(CultureInfo.InvariantCulture);
            }

            if (benchmark.CurrentStatistic != null)
            {
                if (!txtFounds.Focused)
                {
                    txtFounds.Text = benchmark.CurrentStatistic.Founds.ToString(CultureInfo.InvariantCulture);
                }
                if (!txtHashCount.Focused)
                {
                    txtHashCount.Text = GuiHelper.GetRightMagnitude(benchmark.CurrentStatistic.TotalHashCount);
                }
                if (!txtAverageTemperature.Focused)
                {
                    txtAverageTemperature.Text = String.Format("{0:0.##}{1}", benchmark.CurrentStatistic.AverageTemperature, "°C");
                }
                if (!txtAveragePing.Focused)
                {
                    txtAveragePing.Text = String.Format("{0:0.##} {1}", benchmark.CurrentStatistic.AverageShareAnswerPing, "ms");
                }
            }

            if (!txtAlgorithm.Focused)
            {
                txtAlgorithm.Text = benchmark.Algorithm;
            }
            if (!txtMinerName.Focused)
            {
                txtMinerName.Text = benchmark.MinerSetup.ToString();
            }
            if (!txtUrl.Focused)
            {
                txtUrl.Text = benchmark.MinerSetup.MiningUrl;
            }
            if (!txtIntensity.Focused)
            {
                txtIntensity.Text = String.Format("{0:0.####}", benchmark.MinerSetup.Intensity);
            }
            if (!txtPerformanceState.Focused)
            {
                txtPerformanceState.Text = benchmark.MinerSetup.PerformanceState;
            }
            if (!txtBiosVersion.Focused)
            {
                txtBiosVersion.Text = benchmark.MinerSetup.BiosVersion;
            }
            if (!txtDriverVersion.Focused)
            {
                txtDriverVersion.Text = benchmark.MinerSetup.DriverVersion;
            }
            if (!txtOperatingSystem.Focused)
            {
                txtOperatingSystem.Text = benchmark.MinerSetup.OperatingSystem;
            }
        }
Пример #6
0
        public void UpdateGui()
        {
            if (!_pauseUpdate)
            {
                if (Gpu.CurrentBenchmark != null && Gpu.BenchLogs != null && Gpu.BenchLogs.Count > 0)
                {
                    UpdateInternalControls();

                    UserFriendlyBenchmarks = new List <UserFriendlyBenchmark>(Gpu.BenchLogs.Count);
                    foreach (GpuLogger.Benchmark benchmark in Gpu.BenchLogs)
                    {
                        string timeStarted    = GuiHelper.UnixTimeStampToDateTime(benchmark.TimeStamp).ToString("g");
                        string timeLastUpdate = benchmark.SensorLog.Count > 2
                            ? GuiHelper.UnixTimeStampToDateTime(benchmark.SensorLog[benchmark.SensorLog.Count - 1].TimeStamp).ToString("g")
                            : timeStarted;
                        string averageHashRate    = string.Empty;
                        string standardDeviation  = string.Empty;
                        string averageTemperature = string.Empty;
                        string rightMagnitude     = string.Empty;
                        string minerNameVersion   = string.Empty;
                        string stratum            = string.Empty;

                        if (benchmark.CurrentStatistic != null && benchmark.MinerSetup != null)
                        {
                            averageHashRate =
                                GuiHelper.GetRightMagnitude(benchmark.CurrentStatistic.HarmonicAverageHashRate, "H");
                            standardDeviation =
                                GuiHelper.GetRightMagnitude(benchmark.CurrentStatistic.StandardDeviation, "H");
                            rightMagnitude =
                                GuiHelper.GetRightMagnitude(benchmark.CurrentStatistic.TotalHashCount);
                            averageTemperature =
                                benchmark.CurrentStatistic.AverageTemperature.ToString("##.##") + " °C";
                            minerNameVersion = benchmark.MinerSetup.ToString();
                            stratum          = benchmark.MinerSetup.MiningUrl;
                        }

                        UserFriendlyBenchmark userFriendlyBenchmark = new UserFriendlyBenchmark
                        {
                            TimeStarted        = timeStarted,
                            TimeLastUpdate     = timeLastUpdate,
                            Algorithm          = benchmark.Algorithm,
                            AverageHashRate    = averageHashRate,
                            StandardDeviation  = standardDeviation,
                            HashCount          = rightMagnitude,
                            AverageTemperature = averageTemperature,
                            MinerNameVersion   = minerNameVersion,
                            Stratum            = stratum
                        };

                        UserFriendlyBenchmarks.Insert(0, userFriendlyBenchmark);
                    }

                    int rowIndex = dgvBenchmarks.SelectedRows.Count > 0 ? dgvBenchmarks.SelectedRows[0].Index : 0;
                    dgvBenchmarks.DataSource = new SortableBindingList <UserFriendlyBenchmark>(UserFriendlyBenchmarks);
                    if (dgvBenchmarks.Rows.Count > 0)
                    {
                        dgvBenchmarks.CurrentCell = dgvBenchmarks.Rows[rowIndex].Cells[0];
                    }
                }
            }
        }