コード例 #1
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;
            }
        }
コード例 #2
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();
        }
コード例 #3
0
ファイル: GpuTab.cs プロジェクト: senlinms/ccmonitor
        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];
                    }
                }
            }
        }