BenchmarkStart() public method

public BenchmarkStart ( int time, IBenchmarkComunicator benchmarkComunicator ) : void
time int
benchmarkComunicator IBenchmarkComunicator
return void
        private void InitiateBenchmark()
        {
            int algoIndex = index;

            index++;

            if (algoIndex < mm.SupportedAlgorithms.Length)
            {
                if (!mm.SupportedAlgorithms[algoIndex].Skip)
                {
                    if (mm is cpuminer)
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsCPU[TimeIndex];
                    }
                    else if (mm is ccminer)
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsNVIDIA[TimeIndex];
                    }
                    else
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsAMD[TimeIndex] / 60;

                        // add an aditional minute if second is not 0
                        if (DateTime.Now.Second != 0)
                        {
                            Time += 1;
                        }
                    }

                    CurrentAlgoName = mm.SupportedAlgorithms[algoIndex].NiceHashName;
                    UpdateProgressBar(false);
                    mm.BenchmarkStart(algoIndex, Time, BenchmarkCompleted, DevicesListView.Items[DeviceChecked_Index].Tag);
                }
                else
                {
                    UpdateProgressBar(true);
                    InitiateBenchmark();
                }
            }
            else
            {
                double[] div = { 1000000,       // Scrypt MH/s
                                 1000000000000, // SHA256 TH/s
                                 1000000,       // ScryptNf MH/s
                                 1000000,       // X11
                                 1000000,       // X13
                                 1000000,       // Keccak
                                 1000000,       // X15
                                 1000000,       // Nist5
                                 1000000,       // NeoScrypt
                                 1000000,       // Lyra2RE
                                 1000000,       // WhirlpoolX
                                 1000000,       // Qubit
                                 1000000,       // Quark
                                 1000,          // Axiom
                                 1000000,       // Lyra2REv2
                                 1000,          // ScryptJaneNf16
                                 1000000000,    // Blake256r8
                                 1000000000,    // Blake256r14
                                 1000000000,    // Blake256r8vnl
                                 1000000 };     // Daggerhashimoto

                for (int i = 0; i < mm.SupportedAlgorithms.Length; i++)
                {
                    if (!mm.SupportedAlgorithms[i].Skip)
                    {
                        int id = mm.SupportedAlgorithms[i].NiceHashID;
                        if (!mm.SupportedAlgorithms[i].NiceHashName.Equals("daggerhashimoto"))
                        {
                            url += "&speed" + id + "=" + (mm.SupportedAlgorithms[i].BenchmarkSpeed / div[id]).ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
                        }
                        else
                        {
                            url += "&speedeth=" + (mm.SupportedAlgorithms[i].BenchmarkSpeed / div[id]).ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
                        }
                    }
                }

                InBenchmark                  = false;
                DevicesListView.Enabled      = true;
                CloseBtn.Enabled             = true;
                BenchmarkBtn.Text            = "Start";
                BenchmarkProgressBar.Value   = 0;
                LabelProgressPercentage.Text = "Completed!";

                if (mm.BenchmarkSignalQuit)
                {
                    LabelProgressPercentage.Text = "Stopped!";
                    return;
                }

                System.Diagnostics.Process.Start(url);
            }
        }
Example #2
0
        private void InitiateBenchmark()
        {
            if (listView1.Items.Count > index)
            {
                ListViewItem lvi = listView1.Items[index];
                index++;

                if (!lvi.Checked)
                {
                    InitiateBenchmark();
                    return;
                }

                Miner m = lvi.Tag as Miner;
                int   i = (int)lvi.SubItems[2].Tag;
                //lvi.SubItems[3].Text = "Please wait...";
                inBenchmark           = true;
                CurrentlyBenchmarking = m;

                if (m is cpuminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsCPU[TimeIndex];
                    lvi.SubItems[3].Text = String.Format(International.GetText("form2_listView_WaitSeconds"), Time);
                }
                else if (m is ccminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsNVIDIA[TimeIndex];

                    if (lvi.SubItems[2].Text.Equals("daggerhashimoto"))
                    {
                        lvi.SubItems[3].Text = International.GetText("form2_listView_WaitForEth");
                    }
                    else
                    {
                        lvi.SubItems[3].Text = String.Format(International.GetText("form2_listView_WaitSeconds"), Time);
                    }
                }
                else
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsAMD[TimeIndex] / 60;

                    // add an aditional minute if second is not 0
                    if (DateTime.Now.Second != 0)
                    {
                        Time += 1;
                    }

                    if (lvi.SubItems[2].Text.Equals("daggerhashimoto"))
                    {
                        lvi.SubItems[3].Text = International.GetText("form2_listView_WaitForEth");
                    }
                    else
                    {
                        lvi.SubItems[3].Text = String.Format(International.GetText("form2_listView_WaitMinutes"), Time);
                    }
                }

                m.BenchmarkStart(i, Time, BenchmarkCompleted, lvi);
            }
            else
            {
                // average all cpu benchmarks
                if (Globals.Miners[0] is cpuminer)
                {
                    Helpers.ConsolePrint("BENCHMARK", "Calculating average CPU speeds:");

                    double[] Speeds = new double[Globals.Miners[0].SupportedAlgorithms.Length];
                    int[]    MTaken = new int[Globals.Miners[0].SupportedAlgorithms.Length];

                    foreach (ListViewItem lvi in listView1.Items)
                    {
                        if (lvi.Tag is cpuminer)
                        {
                            Miner m = lvi.Tag as Miner;
                            int   i = (int)lvi.SubItems[2].Tag;
                            if (m.SupportedAlgorithms[i].BenchmarkSpeed > 0)
                            {
                                Speeds[i] += m.SupportedAlgorithms[i].BenchmarkSpeed;
                                MTaken[i]++;
                            }
                        }
                    }

                    for (int i = 0; i < Speeds.Length; i++)
                    {
                        if (MTaken[i] > 0)
                        {
                            Speeds[i] /= MTaken[i];
                        }
                        Helpers.ConsolePrint("BENCHMARK", Globals.Miners[0].SupportedAlgorithms[i].NiceHashName + " average speed: " + Globals.Miners[0].PrintSpeed(Speeds[i]));

                        foreach (Miner m in Globals.Miners)
                        {
                            if (m is cpuminer)
                            {
                                m.SupportedAlgorithms[i].BenchmarkSpeed = Speeds[i];
                            }
                        }
                    }
                }

                foreach (ListViewItem lvi in listView1.Items)
                {
                    Miner m = lvi.Tag as Miner;
                    int   i = (int)lvi.SubItems[2].Tag;
                    lvi.SubItems[3].Text = m.PrintSpeed(m.SupportedAlgorithms[i].BenchmarkSpeed);
                }

                Config.RebuildGroups();

                buttonStartBenchmark.Enabled     = true;
                buttonStopBenchmark.Enabled      = false;
                buttonReset.Enabled              = true;
                buttonClose.Enabled              = true;
                buttonCheckProfitability.Enabled = true;
                buttonSubmitHardware.Enabled     = true;
            }
        }
Example #3
0
        private void InitiateBenchmark()
        {
            if (listView1.Items.Count > index)
            {
                ListViewItem lvi = listView1.Items[index];
                index++;

                if (!lvi.Checked)
                {
                    InitiateBenchmark();
                    return;
                }

                Miner m = lvi.Tag as Miner;
                int   i = (int)lvi.SubItems[2].Tag;
                lvi.SubItems[3].Text  = "Please wait...";
                inBenchmark           = true;
                CurrentlyBenchmarking = m;

                if (m is cpuminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsCPU[TimeIndex];
                }
                else if (m is ccminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsNVIDIA[TimeIndex];
                }
                else
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsAMD[TimeIndex] / 60;

                    // add an aditional minute if second is not 0
                    if (DateTime.Now.Second != 0)
                    {
                        Time += 1;
                    }
                }

                m.BenchmarkStart(i, Time, BenchmarkCompleted, lvi);
            }
            else
            {
                // average all cpu benchmarks
                if (Form1.Miners[0] is cpuminer)
                {
                    Helpers.ConsolePrint("BENCHMARK", "Calculating average CPU speeds:");

                    double[] Speeds = new double[Form1.Miners[0].SupportedAlgorithms.Length];
                    int[]    MTaken = new int[Form1.Miners[0].SupportedAlgorithms.Length];

                    foreach (ListViewItem lvi in listView1.Items)
                    {
                        if (lvi.Tag is cpuminer)
                        {
                            Miner m = lvi.Tag as Miner;
                            int   i = (int)lvi.SubItems[2].Tag;
                            if (m.SupportedAlgorithms[i].BenchmarkSpeed > 0)
                            {
                                Speeds[i] += m.SupportedAlgorithms[i].BenchmarkSpeed;
                                MTaken[i]++;
                            }
                        }
                    }

                    for (int i = 0; i < Speeds.Length; i++)
                    {
                        if (MTaken[i] > 0)
                        {
                            Speeds[i] /= MTaken[i];
                        }
                        Helpers.ConsolePrint("BENCHMARK", Form1.Miners[0].SupportedAlgorithms[i].NiceHashName + " average speed: " + Form1.Miners[0].PrintSpeed(Speeds[i]));

                        foreach (Miner m in Form1.Miners)
                        {
                            if (m is cpuminer)
                            {
                                m.SupportedAlgorithms[i].BenchmarkSpeed = Speeds[i];
                            }
                        }
                    }
                }

                foreach (ListViewItem lvi in listView1.Items)
                {
                    Miner m = lvi.Tag as Miner;
                    int   i = (int)lvi.SubItems[2].Tag;
                    lvi.SubItems[3].Text = m.PrintSpeed(m.SupportedAlgorithms[i].BenchmarkSpeed);
                }

                Config.RebuildGroups();

                button1.Enabled = true;
                button2.Enabled = false;
                button3.Enabled = true;
            }
        }
Example #4
0
        private void InitiateBenchmark()
        {
            int algoIndex = index;

            index++;

            if (algoIndex < mm.SupportedAlgorithms.Length)
            {
                if (!mm.SupportedAlgorithms[algoIndex].Skip)
                {
                    if (mm is cpuminer)
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsCPU[TimeIndex];
                    }
                    else if (mm is ccminer)
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsNVIDIA[TimeIndex];
                    }
                    else
                    {
                        Time = Config.ConfigData.BenchmarkTimeLimitsAMD[TimeIndex] / 60;

                        // add an aditional minute if second is not 0
                        if (DateTime.Now.Second != 0)
                        {
                            Time += 1;
                        }
                    }

                    CurrentAlgoName = mm.SupportedAlgorithms[algoIndex].NiceHashName;
                    UpdateProgressBar(false);
                    mm.BenchmarkStart(algoIndex, Time, BenchmarkCompleted, DevicesListView.Items[DeviceChecked_Index].Tag);
                }
                else
                {
                    UpdateProgressBar(true);
                    InitiateBenchmark();
                }
            }
            else
            {
                for (int i = 0; i < mm.SupportedAlgorithms.Length; i++)
                {
                    if (!mm.SupportedAlgorithms[i].Skip)
                    {
                        int id = mm.SupportedAlgorithms[i].NiceHashID;
                        url += "&speed" + id + "=" + (mm.SupportedAlgorithms[i].BenchmarkSpeed / div[id]).ToString("F2", System.Globalization.CultureInfo.InvariantCulture);
                    }
                }

                InBenchmark                  = false;
                DevicesListView.Enabled      = true;
                CloseBtn.Enabled             = true;
                StartStopBtn.Text            = International.GetText("SubmitResultDialog_StartBtn");
                BenchmarkProgressBar.Value   = 0;
                LabelProgressPercentage.Text = International.GetText("SubmitResultDialog_LabelProgressPercentageCompleted");

                if (mm.BenchmarkSignalQuit)
                {
                    LabelProgressPercentage.Text = International.GetText("SubmitResultDialog_LabelProgressPercentageStopped");
                    return;
                }

                url += "&nhmver=" + Application.ProductVersion.ToString(); // Add version info
                url += "&cost=1&power=1";                                  // Set default power and cost to 1
                System.Diagnostics.Process.Start(url);
            }
        }