public override void EndBenchmarkProcces() { if (BenchmarkProcessStatus != BenchmarkProcessStatus.Killing && BenchmarkProcessStatus != BenchmarkProcessStatus.DoneKilling) { BenchmarkProcessStatus = BenchmarkProcessStatus.Killing; try { Helpers.ConsolePrint("BENCHMARK", $"Trying to kill benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName}"); 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); // ManagementObject mo = new ManagementObject("win32_process.handle='" + cpid + "'"); // mo.Get(); // int parentId = Convert.ToInt32(mo["ParentProcessId"]); KillProcessAndChildren(pid); BenchmarkHandle.Kill(); BenchmarkHandle.Close(); Killmkxminer(); } catch { } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.DoneKilling; Helpers.ConsolePrint("BENCHMARK", $"Benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName} KILLED"); //BenchmarkHandle = null; } } }
public override void EndBenchmarkProcces() { if (BenchmarkProcessStatus != BenchmarkProcessStatus.Killing && BenchmarkProcessStatus != BenchmarkProcessStatus.DoneKilling) { BenchmarkProcessStatus = BenchmarkProcessStatus.Killing; try { Helpers.ConsolePrint("BENCHMARK", $"Trying to kill benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName}"); 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); BenchmarkHandle.Kill(); BenchmarkHandle.Close(); } catch { } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.DoneKilling; Helpers.ConsolePrint("BENCHMARK", $"Benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName} KILLED"); //BenchmarkHandle = null; } } }
// killing proccesses can take time virtual public void EndBenchmarkProcces() { if (BenchmarkHandle != null && BenchmarkProcessStatus != BenchmarkProcessStatus.Killing && BenchmarkProcessStatus != BenchmarkProcessStatus.DoneKilling) { BenchmarkProcessStatus = BenchmarkProcessStatus.Killing; try { Helpers.ConsolePrint("BENCHMARK", String.Format("Trying to kill benchmark process {0} algorithm {1}", BenchmarkProcessPath, BenchmarkAlgorithm.NiceHashName)); BenchmarkHandle.Kill(); BenchmarkHandle.Close(); } catch { } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.DoneKilling; Helpers.ConsolePrint("BENCHMARK", String.Format("Benchmark process {0} algorithm {1} KILLED", BenchmarkProcessPath, BenchmarkAlgorithm.NiceHashName)); //BenchmarkHandle = null; } } }
// killing proccesses can take time public virtual void EndBenchmarkProcces() { if (BenchmarkHandle != null && BenchmarkProcessStatus != BenchmarkProcessStatus.Killing && BenchmarkProcessStatus != BenchmarkProcessStatus.DoneKilling) { BenchmarkProcessStatus = BenchmarkProcessStatus.Killing; try { Helpers.ConsolePrint("BENCHMARK", $"Trying to kill benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName}"); BenchmarkHandle.Kill(); BenchmarkHandle.Close(); KillAllUsedMinerProcesses(); } catch { } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.DoneKilling; Helpers.ConsolePrint("BENCHMARK", $"Benchmark process {BenchmarkProcessPath} algorithm {BenchmarkAlgorithm.AlgorithmName} KILLED"); //BenchmarkHandle = null; } } }