/// <summary> /// The BenchmarkThreadRoutine /// </summary> /// <param name="CommandLine">The <see cref="object"/></param> protected override void BenchmarkThreadRoutine(object CommandLine) { Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; var startTime = DateTime.Now; try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTAG(), "Benchmark should end in : " + benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)CommandLine); Stopwatch _benchmarkTimer = new Stopwatch(); _benchmarkTimer.Reset(); _benchmarkTimer.Start(); //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; bool keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (_benchmarkTimer.Elapsed.TotalSeconds >= (benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { string imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillProspectorClaymoreMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } else { // wait a second reduce CPU load Thread.Sleep(1000); } } BenchmarkHandle.WaitForExit(20 * 1000); // Wait up to 20s for exit } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; if (database == null) { try { database = new ProspectorDatabase(WorkingDirectory + "info.db"); } catch (Exception e) { Helpers.ConsolePrint(MinerTAG(), e.ToString()); } } var session = database.LastSession(); var sessionStart = Convert.ToDateTime(session.start); if (sessionStart < startTime) { throw new Exception("Session not recorded!"); } var hashrates = database.QuerySpeedsForSession(session.id); double speed = 0; int speedRead = 0; foreach (var hashrate in hashrates) { if (hashrate.coin == MiningSetup.MinerName && hashrate.rate > 0) { speed += hashrate.rate; speedRead++; } } BenchmarkAlgorithm.BenchmarkSpeed = (speed / speedRead) * (1 - DevFee); BenchmarkThreadRoutineFinish(); } }
// benchmark stuff protected override void BenchmarkThreadRoutine(object CommandLine) { Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTAG(), "Benchmark should end in : " + benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)CommandLine); BenchmarkHandle.WaitForExit(benchmarkTimeWait + 2); Stopwatch _benchmarkTimer = new Stopwatch(); _benchmarkTimer.Reset(); _benchmarkTimer.Start(); //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; bool keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (_benchmarkTimer.Elapsed.TotalSeconds >= (benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { string imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillClaymoreMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } else { // wait a second reduce CPU load Thread.Sleep(1000); } } } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; // find latest log file string latestLogFile = ""; var dirInfo = new DirectoryInfo(this.WorkingDirectory); foreach (var file in dirInfo.GetFiles("*_log.txt")) { latestLogFile = file.Name; break; } // read file log if (File.Exists(WorkingDirectory + latestLogFile)) { var lines = File.ReadAllLines(WorkingDirectory + latestLogFile); var addBenchLines = bench_lines.Count == 0; foreach (var line in lines) { if (line != null) { bench_lines.Add(line); string lineLowered = line.ToLower(); if (lineLowered.Contains(LOOK_FOR_START)) { if (ignoreZero) { double got = getNumber(lineLowered); if (got != 0) { benchmark_sum += got; ++benchmark_read_count; } } else { benchmark_sum += getNumber(lineLowered); ++benchmark_read_count; } } else if (lineLowered.Contains(SecondaryLookForStart())) { if (ignoreZero) { double got = getNumber(lineLowered, SecondaryLookForStart(), LOOK_FOR_END); if (got != 0) { secondary_benchmark_sum += got; ++secondary_benchmark_read_count; } } else { secondary_benchmark_sum += getNumber(lineLowered); ++secondary_benchmark_read_count; } } } } if (benchmark_read_count > 0) { BenchmarkAlgorithm.BenchmarkSpeed = benchmark_sum / benchmark_read_count; BenchmarkAlgorithm.SecondaryBenchmarkSpeed = secondary_benchmark_sum / secondary_benchmark_read_count; } } BenchmarkThreadRoutineFinish(); } }
protected override void BenchmarkThreadRoutine(object commandLine) { BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in : " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); var benchmarkTimer = new Stopwatch(); benchmarkTimer.Reset(); benchmarkTimer.Start(); //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; var keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (benchmarkTimer.Elapsed.TotalSeconds >= (_benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { var imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process EndBenchmarkProcces(); KillMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } // wait a second reduce CPU load Thread.Sleep(1000); } } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; // find latest log file var latestLogFile = ""; var dirInfo = new DirectoryInfo(WorkingDirectory); foreach (var file in dirInfo.GetFiles(GetLogFileName())) { latestLogFile = file.Name; break; } // read file log if (File.Exists(WorkingDirectory + latestLogFile)) { var lines = new string[0]; var read = false; var iteration = 0; while (!read) { if (iteration < 10) { try { lines = File.ReadAllLines(WorkingDirectory + latestLogFile); read = true; Helpers.ConsolePrint(MinerTag(), "Successfully read log after " + iteration + " iterations"); } catch (Exception ex) { Helpers.ConsolePrint(MinerTag(), ex.Message); Thread.Sleep(1000); } iteration++; } else { read = true; // Give up after 10s Helpers.ConsolePrint(MinerTag(), "Gave up on iteration " + iteration); } } var addBenchLines = BenchLines.Count == 0; foreach (var line in lines) { if (line != null) { BenchLines.Add(line); var lineLowered = line.ToLower(); if (lineLowered.Contains(LookForStart)) { _benchmarkSum += GetNumber(lineLowered); ++_benchmarkReadCount; } } } if (_benchmarkReadCount > 0) { BenchmarkAlgorithm.BenchmarkSpeed = _benchmarkSum / _benchmarkReadCount; } } BenchmarkThreadRoutineFinish(); } }
protected override void BenchmarkThreadRoutine(object commandLine) { BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); try { try { var latestLogFile = GetLogFileName(); var dirInfo = new DirectoryInfo(WorkingDirectory); if (File.Exists(WorkingDirectory + latestLogFile)) { var loglines = File.ReadAllLines(WorkingDirectory + latestLogFile); } } catch { Helpers.ConsolePrint("BENCHMARK", "Benchmark skip"); return; } Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in : " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); var benchmarkTimer = new Stopwatch(); benchmarkTimer.Reset(); benchmarkTimer.Start(); //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; var keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (benchmarkTimer.Elapsed.TotalSeconds >= (_benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { var imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillMinerBase(imageName); //Stop_cpu_ccminer_sgminer_nheqminer(MinerStopType.END); /* * if (ProcessHandle != null) * { * try { ProcessHandle.Kill(); } * catch { } * } */ int k = ProcessTag().IndexOf("pid("); int i = ProcessTag().IndexOf(")|bin"); var cpid = ProcessTag().Substring(k + 4, i - k - 4).Trim(); int pid = int.Parse(cpid, CultureInfo.InvariantCulture); KillProcessAndChildren(pid); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } // wait a second reduce CPU load Thread.Sleep(1000); } } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; var latestLogFile = GetLogFileName(); var dirInfo = new DirectoryInfo(WorkingDirectory); // read file log Thread.Sleep(1000); if (File.Exists(WorkingDirectory + latestLogFile)) { var lines = new string[0]; var read = false; var iteration = 0; while (!read) { if (iteration < 10) { try { lines = File.ReadAllLines(WorkingDirectory + latestLogFile); read = true; Helpers.ConsolePrint(MinerTag(), "Successfully read log after " + iteration + " iterations"); } catch (Exception ex) { Helpers.ConsolePrint(MinerTag(), ex.Message); Thread.Sleep(1000); } iteration++; } else { read = true; // Give up after 10s Helpers.ConsolePrint(MinerTag(), "Gave up on iteration " + iteration); } } var addBenchLines = BenchLines.Count == 0; foreach (var line in lines) { if (line != null) { if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.MTP)) { if (line.Contains("1/1") || line.Contains("0/1")) { var st = line.IndexOf("- "); var e = line.ToLower().IndexOf("h/s"); var parse = line.Substring(st + 2, e - st - 4).Trim(); double tmp = Double.Parse(parse, CultureInfo.InvariantCulture); // save speed if (line.ToLower().Contains("kh/s")) { tmp *= 1000; } else if (line.ToLower().Contains("mh/s")) { tmp *= 1000000; } BenchmarkAlgorithm.BenchmarkSpeed = tmp; BenchmarkSignalFinnished = true; } } if (line.Contains("3/3") || line.Contains("2/3")) { var st = line.IndexOf("- "); var e = line.ToLower().IndexOf("h/s"); var parse = line.Substring(st + 2, e - st - 4).Trim(); double tmp = Double.Parse(parse, CultureInfo.InvariantCulture); // save speed if (line.ToLower().Contains("kh/s")) { tmp *= 1000; } else if (line.ToLower().Contains("mh/s")) { tmp *= 1000000; } BenchmarkAlgorithm.BenchmarkSpeed = tmp; BenchmarkSignalFinnished = true; } if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.Lyra2z)) { if (line.Contains("6/6") || line.Contains("5/6")) { var st = line.IndexOf("- "); var e = line.ToLower().IndexOf("h/s"); var parse = line.Substring(st + 2, e - st - 4).Trim(); double tmp = Double.Parse(parse, CultureInfo.InvariantCulture); // save speed if (line.ToLower().Contains("kh/s")) { tmp *= 1000; } else if (line.ToLower().Contains("mh/s")) { tmp *= 1000000; } BenchmarkAlgorithm.BenchmarkSpeed = tmp; BenchmarkSignalFinnished = true; } } if (MiningSetup.CurrentAlgorithmType.Equals(AlgorithmType.X16R)) { if (line.Contains("6/6") || line.Contains("5/6")) { var st = line.IndexOf("- "); var e = line.ToLower().IndexOf("h/s"); var parse = line.Substring(st + 2, e - st - 4).Trim(); double tmp = Double.Parse(parse, CultureInfo.InvariantCulture); // save speed if (line.ToLower().Contains("kh/s")) { tmp *= 1000; } else if (line.ToLower().Contains("mh/s")) { tmp *= 1000000; } BenchmarkAlgorithm.BenchmarkSpeed = tmp; BenchmarkSignalFinnished = true; } } } } } BenchmarkThreadRoutineFinish(); } }
/// <summary> /// Thread routine for miners that cannot be scheduled to stop and need speed data read from command line /// </summary> /// <param name="commandLine"></param> /// <param name="benchmarkTimeWait"></param> protected void BenchmarkThreadRoutineAlternate(object commandLine, int benchmarkTimeWait) { CleanAllOldLogs(); Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTag(), "Benchmark should end in : " + benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); BenchmarkHandle.WaitForExit(benchmarkTimeWait + 2); var benchmarkTimer = new Stopwatch(); benchmarkTimer.Reset(); benchmarkTimer.Start(); //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; var keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (benchmarkTimer.Elapsed.TotalSeconds >= (benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { var imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillProspectorClaymoreMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } // wait a second reduce CPU load Thread.Sleep(1000); } } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; // find latest log file var latestLogFile = ""; var dirInfo = new DirectoryInfo(WorkingDirectory); foreach (var file in dirInfo.GetFiles("*_log.txt")) { latestLogFile = file.Name; break; } BenchmarkHandle.WaitForExit(10000); // read file log if (File.Exists(WorkingDirectory + latestLogFile)) { var lines = File.ReadAllLines(WorkingDirectory + latestLogFile); ProcessBenchLinesAlternate(lines); } BenchmarkThreadRoutineFinish(); } }
/// <summary> /// The BenchmarkThreadRoutine /// </summary> /// <param name="CommandLine">The <see cref="object"/></param> protected override void BenchmarkThreadRoutine(object CommandLine) { Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; try { Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTAG(), "Benchmark should end in : " + benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)CommandLine); BenchmarkHandle.WaitForExit(benchmarkTimeWait + 2); Stopwatch _benchmarkTimer = new Stopwatch(); _benchmarkTimer.Reset(); _benchmarkTimer.Start(); BenchmarkProcessStatus = BenchmarkProcessStatus.Running; bool keepRunning = true; while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { if (_benchmarkTimer.Elapsed.TotalSeconds >= (benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { string imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } else { // wait a second reduce CPU load Thread.Sleep(1000); } } } catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); } finally { BenchmarkAlgorithm.BenchmarkSpeed = 0; // find latest log file Thread.Sleep(1000); string latestLogFile = ""; var dirInfo = new DirectoryInfo(WorkingDirectory); foreach (var file in dirInfo.GetFiles("*_log.txt")) { latestLogFile = file.Name; break; } // read file log if (File.Exists(WorkingDirectory + latestLogFile)) { var lines = new string[0]; var read = false; var iteration = 0; while (!read) { if (iteration < 10) { try { lines = File.ReadAllLines(WorkingDirectory + latestLogFile); read = true; Helpers.ConsolePrint(MinerTAG(), "Successfully read log after " + iteration.ToString() + " iterations"); } catch (Exception ex) { Helpers.ConsolePrint(MinerTAG(), ex.Message); Thread.Sleep(1000); } iteration++; } else { read = true; // Give up after 10s Helpers.ConsolePrint(MinerTAG(), "Gave up on iteration " + iteration.ToString()); } } var addBenchLines = bench_lines.Count == 0; foreach (var line in lines) { if (line != null) { bench_lines.Add(line); string lineLowered = line.ToLower(); if (lineLowered.Contains(LOOK_FOR_START)) { benchmark_sum += GetNumber(lineLowered); ++benchmark_read_count; } } } if (benchmark_read_count > 0) { BenchmarkAlgorithm.BenchmarkSpeed = benchmark_sum / benchmark_read_count; } } BenchmarkThreadRoutineFinish(); } }
protected override void BenchmarkThreadRoutine(object commandLine) { BenchmarkSignalQuit = false; BenchmarkSignalHanged = false; BenchmarkSignalFinnished = false; BenchmarkException = null; Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS); Helpers.ConsolePrint("BENCHMARK", "Benchmark starts"); Helpers.ConsolePrint(MinerTAG(), "Benchmark should end in : " + _benchmarkTimeWait + " seconds"); BenchmarkHandle = BenchmarkStartProcess((string)commandLine); BenchmarkHandle.WaitForExit(_benchmarkTimeWait + 2); var benchmarkTimer = new Stopwatch(); benchmarkTimer.Reset(); benchmarkTimer.Start(); BenchmarkProcessStatus = BenchmarkProcessStatus.Running; var keepRunning = true; List <double> speed = new List <double>(); try { while (keepRunning && IsActiveProcess(BenchmarkHandle.Id)) { Task <APIData> AD = GetSummaryAsync(); Task.WaitAll(AD); speed.Add(AD.Result.Speed); //string outdata = BenchmarkHandle.StandardOutput.ReadLine(); //BenchmarkOutputErrorDataReceivedImpl(outdata); // terminate process situations if (benchmarkTimer.Elapsed.TotalSeconds >= (_benchmarkTimeWait + 2) || BenchmarkSignalQuit || BenchmarkSignalFinnished || BenchmarkSignalHanged || BenchmarkSignalTimedout || BenchmarkException != null) { var imageName = MinerExeName.Replace(".exe", ""); // maybe will have to KILL process KillMinerBase(imageName); if (BenchmarkSignalTimedout) { throw new Exception("Benchmark timedout"); } if (BenchmarkException != null) { throw BenchmarkException; } if (BenchmarkSignalQuit) { throw new Exception("Termined by user request"); } if (BenchmarkSignalFinnished) { break; } keepRunning = false; break; } // wait a second reduce CPU load Thread.Sleep(1000); } }catch (Exception ex) { BenchmarkThreadRoutineCatch(ex); Helpers.ConsolePrint("Benchmark Error:", " " + ex.ToString()); } finally { if (speed.Count == 0) { Helpers.ConsolePrint("Benchmark Error:", " Benchmarks returned 0"); } else { BenchmarkAlgorithm.BenchmarkSpeed = 0; BenchmarkAlgorithm.BenchmarkSpeed = speed.Average(); } BenchmarkThreadRoutineFinish(); } }