private void CreateProcessAsync() { Task.Factory.StartNew(() => { lock (_locker) { try { // 清理除当前外的Temp/Kernel Cleaner.Instance.Clear(); NTMinerConsole.UserOk("场地打扫完毕"); // 应用超频 if (NTMinerContext.Instance.GpuProfileSet.IsOverClockEnabled(MainCoin.GetId())) { NTMinerConsole.UserWarn("应用超频,如果CPU性能较差耗时可能超过1分钟,请耐心等待"); var cmd = new CoinOverClockCommand(coinId: MainCoin.GetId()); AddOnecePath <CoinOverClockDoneEvent>("超频完成后继续流程", LogEnum.DevConsole, message => { // pathId是唯一的,从而可以断定该消息一定是因为该命令而引发的 ContinueCreateProcess(); }, location: this.GetType(), pathId: cmd.MessageId); // 超频是在另一个线程执行的,因为N卡超频当cpu性能非常差时较耗时 VirtualRoot.Execute(cmd); } else { ContinueCreateProcess(); } } catch (Exception e) { Logger.ErrorDebugLine(e); NTMinerConsole.UserFail("挖矿内核启动失败,请联系开发人员解决"); } } }); }
private void CreateProcessAsync() { Task.Factory.StartNew(() => { lock (_locker) { try { #if DEBUG NTStopwatch.Start(); #endif // 清理除当前外的Temp/Kernel Cleaner.Instance.Clear(); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.{nameof(CreateProcessAsync)}[{nameof(Cleaner)}.{nameof(Cleaner.Clear)}]"); } #endif Write.UserOk("场地打扫完毕"); // 应用超频 if (NTMinerContext.Instance.GpuProfileSet.IsOverClockEnabled(MainCoin.GetId())) { Write.UserWarn("应用超频,如果CPU性能较差耗时可能超过1分钟,请耐心等待"); var cmd = new CoinOverClockCommand(coinId: MainCoin.GetId()); AddOnecePath <CoinOverClockDoneEvent>("超频完成后继续流程", LogEnum.DevConsole, message => { // pathId是唯一的,从而可以断定该消息一定是因为该命令而引发的 ContinueCreateProcess(); }, location: this.GetType(), pathId: cmd.MessageId); // 超频是在另一个线程执行的,因为N卡超频当cpu性能非常差时较耗时 VirtualRoot.Execute(cmd); } else { ContinueCreateProcess(); } } catch (Exception e) { Logger.ErrorDebugLine(e); Write.UserFail("挖矿内核启动失败,请联系开发人员解决"); } } }); }