コード例 #1
0
        protected override NiceHashProcess _Start()
        {
            NiceHashProcess P = base._Start();

            if (CPUs.Count > 0 && CPUs[0].AffinityMask != 0 && P != null)
            {
                CPUID.AdjustAffinity(P.Id, CPUs[0].AffinityMask);
            }

            return(P);
        }
コード例 #2
0
        protected override NiceHashProcess _Start()
        {
            NiceHashProcess P = base._Start();

            var AffinityMask = MiningSetup.MiningPairs[0].Device.AffinityMask;

            if (AffinityMask != 0 && P != null)
            {
                CPUID.AdjustAffinity(P.Id, AffinityMask);
            }

            return(P);
        }
コード例 #3
0
ファイル: Miner.cs プロジェクト: nicehash/NiceHashMiner
        protected virtual NiceHashProcess _Start()
        {
            PreviousTotalMH = 0.0;
            if (LastCommandLine.Length == 0) return null;

            NiceHashProcess P = new NiceHashProcess();

            if (WorkingDirectory.Length > 1)
            {
                P.StartInfo.WorkingDirectory = WorkingDirectory;
            }

            P.StartInfo.FileName = Path;
            P.ExitEvent = Miner_Exited;

            P.StartInfo.Arguments = LastCommandLine;
            if (Path != MinerPaths.eqm) {
                P.StartInfo.CreateNoWindow = ConfigManager.GeneralConfig.HideMiningWindows;
            } else {
                P.StartInfo.CreateNoWindow = false;
            }
            P.StartInfo.UseShellExecute = false;

            try
            {
                if (P.Start()) {
                    IsRunning = true;

                    _currentPidData = new MinerPID_Data();
                    _currentPidData.minerBinPath = P.StartInfo.FileName;
                    _currentPidData.PID = P.Id;
                    _allPidData.Add(_currentPidData);

                    Helpers.ConsolePrint(MinerTAG(), "Starting miner " + ProcessTag() + " " + LastCommandLine);

                    StartCoolDownTimerChecker();
                    isEnded = false;

                    return P;
                } else {
                    Helpers.ConsolePrint(MinerTAG(), "NOT STARTED " + ProcessTag() + " " + LastCommandLine);
                    return null;
                }
            }
            catch (Exception ex)
            {
                Helpers.ConsolePrint(MinerTAG(), ProcessTag() + " _Start: " + ex.Message);
                return null;
            }
        }
コード例 #4
0
ファイル: Miner.cs プロジェクト: nicehash/NiceHashMiner
 private void Restart()
 {
     if (!isEnded) {
         Helpers.ConsolePrint(MinerTAG(), ProcessTag() + " Restarting miner..");
         Stop(MinerStopType.END); // stop miner first
         System.Threading.Thread.Sleep(ConfigManager.GeneralConfig.MinerRestartDelayMS);
         ProcessHandle = _Start(); // start with old command line
     }
 }
コード例 #5
0
ファイル: Miner.cs プロジェクト: nicehash/NiceHashMiner
        protected void Stop_cpu_ccminer_sgminer_nheqminer(MinerStopType willswitch)
        {
            if (IsRunning) {
                Helpers.ConsolePrint(MinerTAG(), ProcessTag() + " Shutting down miner");
            }
            if (willswitch != MinerStopType.FORCE_END) ChangeToNextAvaliablePort();
            if (ProcessHandle != null) {
                try { ProcessHandle.Kill(); } catch { }
                ProcessHandle.Close();
                ProcessHandle = null;

                // sgminer needs to be removed and kill by PID
                if (IsKillAllUsedMinerProcs) KillAllUsedMinerProcesses();
            }
        }