FormatSpeedOutput() public static method

public static FormatSpeedOutput ( double speed ) : string
speed double
return string
Ejemplo n.º 1
0
        virtual protected void BenchmarkThreadRoutine(object CommandLine)
        {
            Thread.Sleep(ConfigManager.Instance.GeneralConfig.MinerRestartDelayMS);

            BenchmarkSignalQuit      = false;
            BenchmarkSignalHanged    = false;
            BenchmarkSignalFinnished = false;
            BenchmarkException       = null;

            try {
                Helpers.ConsolePrint("BENCHMARK", "Benchmark starts");
                BenchmarkHandle = BenchmarkStartProcess((string)CommandLine);

                BenchmarkThreadRoutineStartSettup();
                // wait a little longer then the benchmark routine if exit false throw
                //var timeoutTime = BenchmarkTimeoutInSeconds(BenchmarkTimeInSeconds);
                //var exitSucces = BenchmarkHandle.WaitForExit(timeoutTime * 1000);
                // don't use wait for it breaks everything
                BenchmarkProcessStatus = BenchmarkProcessStatus.Running;
                BenchmarkHandle.WaitForExit();
                if (BenchmarkSignalTimedout)
                {
                    throw new Exception("Benchmark timedout");
                }
                if (BenchmarkException != null)
                {
                    throw BenchmarkException;
                }
                if (BenchmarkSignalQuit)
                {
                    throw new Exception("Termined by user request");
                }
                if (BenchmarkSignalHanged)
                {
                    throw new Exception("SGMiner is not responding");
                }
                if (BenchmarkSignalFinnished)
                {
                    //break;
                }
            } catch (Exception ex) {
                BenchmarkAlgorithm.BenchmarkSpeed = 0;

                Helpers.ConsolePrint(MinerTAG(), "Benchmark Exception: " + ex.Message);
                if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled)
                {
                    OnBenchmarkCompleteCalled = true;
                    BenchmarkComunicator.OnBenchmarkComplete(false, BenchmarkSignalTimedout ? International.GetText("Benchmark_Timedout") : International.GetText("Benchmark_Terminated"));
                }
            } finally {
                BenchmarkProcessStatus = BenchmarkProcessStatus.Success;
                Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed));
                Helpers.ConsolePrint("BENCHMARK", "Benchmark ends");
                if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled)
                {
                    OnBenchmarkCompleteCalled = true;
                    BenchmarkComunicator.OnBenchmarkComplete(true, "Success");
                }
            }
        }
Ejemplo n.º 2
0
        protected void BenchmarkThreadRoutineFinish()
        {
            BenchmarkProcessStatus status = BenchmarkProcessStatus.Finished;

            if (BenchmarkAlgorithm.BenchmarkSpeed > 0)
            {
                status = BenchmarkProcessStatus.Success;
            }

            using (StreamWriter sw = File.AppendText(benchmarkLogPath)) {
                foreach (var line in bench_lines)
                {
                    sw.WriteLine(line);
                }
            }
            BenchmarkProcessStatus = status;
            Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed));
            Helpers.ConsolePrint("BENCHMARK", "Benchmark ends");
            if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled)
            {
                OnBenchmarkCompleteCalled = true;
                bool   isOK = BenchmarkProcessStatus.Success == status;
                string msg  = GetFinalBenchmarkString();
                BenchmarkComunicator.OnBenchmarkComplete(isOK, isOK ? "" : msg);
            }
        }
Ejemplo n.º 3
0
 public string BenchmarkSpeedString()
 {
     if (!Skip && IsBenchmarkPending && !string.IsNullOrEmpty(BenchmarkStatus))
     {
         return(BenchmarkStatus);
     }
     else if (BenchmarkSpeed > 0)
     {
         return(Helpers.FormatSpeedOutput(BenchmarkSpeed));
     }
     return(International.GetText("BenchmarkSpeedStringNone"));
 }
Ejemplo n.º 4
0
        public void AddRateInfo(string groupName, string deviceStringInfo, APIData iAPIData, double paying, bool isApiGetException)
        {
            string ApiGetExceptionString = isApiGetException ? "**" : "";

            string speedString        = Helpers.FormatSpeedOutput(iAPIData.Speed) + iAPIData.AlgorithmName + ApiGetExceptionString;
            string rateBTCString      = FormatPayingOutput(paying);
            string rateCurrencyString = CurrencyConverter.CurrencyConverter.ConvertToActiveCurrency(paying * Globals.BitcoinRate).ToString("F2", CultureInfo.InvariantCulture)
                                        + String.Format(" {0}/", ConfigManager.Instance.GeneralConfig.DisplayCurrency) + International.GetText("Day");

            ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++])
            .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString);

            UpdateGlobalRate();
        }
Ejemplo n.º 5
0
 protected void BenchmarkThreadRoutineFinish(BenchmarkProcessStatus status)
 {
     using (StreamWriter sw = File.AppendText(benchmarkLogPath)) {
         foreach (var line in bench_lines)
         {
             sw.WriteLine(line);
         }
     }
     BenchmarkProcessStatus = status;
     Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed));
     Helpers.ConsolePrint("BENCHMARK", "Benchmark ends");
     if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled)
     {
         OnBenchmarkCompleteCalled = true;
         BenchmarkComunicator.OnBenchmarkComplete(true, "Success");
     }
 }
Ejemplo n.º 6
0
        public void AddRateInfo(string groupName, string deviceStringInfo, APIData iAPIData, double paying, bool isApiGetException)
        {
            string ApiGetExceptionString = isApiGetException ? "**" : "";

            string speedString = Helpers.FormatSpeedOutput(iAPIData.Speed) + iAPIData.AlgorithmName + ApiGetExceptionString;

            if (iAPIData.AlgorithmID == AlgorithmType.Equihash)
            {
                speedString = speedString.Replace("H/s", "Sols/s");
            }

            string rateBTCString      = FormatPayingOutput(paying);
            string rateCurrencyString = ExchangeRateAPI.ConvertToActiveCurrency(paying * Globals.BitcoinUSDRate).ToString("F2", CultureInfo.InvariantCulture)
                                        + String.Format(" {0}/", ExchangeRateAPI.ActiveDisplayCurrency) + International.GetText("Day");

            ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++])
            .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString);

            UpdateGlobalRate();
        }