private StartStopMineButtonViewModel() { if (WpfUtil.IsInDesignMode) { return; } #if DEBUG NTStopwatch.Start(); #endif this.StartMine = new DelegateCommand(() => { VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"手动开始挖矿", toConsole: true); NTMinerRoot.Instance.StartMine(); }); this.StopMine = new DelegateCommand(() => { VirtualRoot.ThisLocalInfo(nameof(StartStopMineButtonViewModel), $"手动停止挖矿", toConsole: true); if (!NTMinerRoot.Instance.IsMining) { this.MinerProfile.IsMining = false; } NTMinerRoot.IsAutoStartCanceled = true; NTMinerRoot.Instance.StopMineAsync(StopMineReason.LocalUserAction, () => { if (!NTMinerRoot.Instance.IsMining) { this.MinerProfile.IsMining = false; } }); }); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
/// <summary> /// Load up data and plot the jet pT for jets with /// eta less than 1.5. /// </summary> /// <param name="args"></param> static void Main(string[] args) { var t = new NTStopwatch(); t.Start(); var dataset = "user.emmat.mc15_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.merge.AOD.e3668_s2576_s2132_r6765_r6282__EXOT15_v3_EXT0"; var jobFiles = GRIDJobs.FindJobFiles("DiVertAnalysis", 3, dataset); var events = QueryablerecoTree.CreateQueriable(jobFiles); //events.CleanupQuery = false; // Set to keep C++ around //events.IgnoreQueryCache = true; // Set to ignore query cache for speed using (var f = new FutureTFile("S1.root")) { var count = events.FutureCount(); events .SelectMany(e => e.Jet) .Where(j => Math.Abs(j.eta) < 1.5) .FuturePlot("pt", "Jet pT; pT [GeV]", 100, 0.0, 100.0, j => j.pT) .Save(f); Console.WriteLine($"Saw {count.Value} events."); } // Print out usage Console.WriteLine("Time taken to run this query:"); t.Stop(); t.Print(); }
private void Init(List <CalcConfigData> data) { #if DEBUG NTStopwatch.Start(); #endif var list = _root.ServerContext.CoinSet.AsEnumerable().OrderBy(a => a.Code).Select(a => new CalcConfigData { CoinCode = a.Code, CreatedOn = DateTime.Now, IncomePerDay = 0, ModifiedOn = DateTime.Now, Speed = 0, SpeedUnit = "H/s" }).ToList(); foreach (var item in data) { var exist = list.FirstOrDefault(a => string.Equals(a.CoinCode, item.CoinCode, StringComparison.OrdinalIgnoreCase)); if (exist != null) { exist.Update(item); } else { list.Add(item); } } _dicByCoinCode = list.ToDictionary(a => a.CoinCode, a => a, StringComparer.OrdinalIgnoreCase); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.Init"); } #endif }
private VirtualMemorySetViewModel() { #if DEBUG NTStopwatch.Start(); #endif foreach (var item in GetPagingFiles()) { _initialVms.Add(item.DriveName, item); } foreach (var drive in AppContext.Instance.DriveSetVm.Drives) { _dic.Add(drive.Name, new VirtualMemoryViewModel(drive.Name, 0)); } foreach (var item in _initialVms.Values) { if (_dic.TryGetValue(item.DriveName, out VirtualMemoryViewModel vm)) { vm.MaxSizeMb = item.MaxSizeMb; } } NTMinerRoot.SetOSVirtualMemoryMb(_dic.Values.Sum(a => a.MaxSizeMb)); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
private void OverClock(INTMinerContext root, IGpuProfile data) { #if DEBUG NTStopwatch.Start(); #endif if (root.GpuSet.TryGetGpu(data.Index, out IGpu gpu)) { // fanSpeed == -1表示开源自动温控 int fanSpeed = data.IsAutoFanSpeed ? -1 : data.Cool; root.GpuSet.OverClock.OverClock(data.Index, data.CoreClockDelta, data.CoreVoltage, data.MemoryClockDelta, data.MemoryVoltage, data.PowerCapacity, data.TempLimit, fanSpeed); if (data.Index == NTMinerContext.GpuAllId) { NTMinerConsole.UserOk($"统一超频:{data.ToOverClockString()}"); } else { NTMinerConsole.UserOk($"GPU{gpu.Index}超频:{data.ToOverClockString()}"); } 2.SecondsDelay().ContinueWith(t => { root.GpuSet.OverClock.RefreshGpuState(data.Index); }); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.{nameof(OverClock)}"); } #endif }
private void OverClock(INTMinerContext ntminerContext, IGpuProfile data) { #if DEBUG NTStopwatch.Start(); #endif if (ntminerContext.GpuSet.TryGetGpu(data.Index, out IGpu gpu)) { ntminerContext.GpuSet.OverClock.OverClock(gpuIndex: data.Index, OverClockValue.Create(data)); if (data.Index == NTMinerContext.GpuAllId) { NTMinerConsole.UserOk($"统一超频:{data.ToOverClockString()}"); } else { NTMinerConsole.UserOk($"GPU{gpu.Index}超频:{data.ToOverClockString()}"); } 2.SecondsDelay().ContinueWith(t => { ntminerContext.GpuSet.OverClock.RefreshGpuState(data.Index); }); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.{nameof(OverClock)}"); } #endif }
public AMDGpuSet() { #if DEBUG NTStopwatch.Start(); #endif this.Properties = new List<GpuSetProperty>(); this.OverClock = new GpuOverClock(adlHelper); VirtualRoot.AddEventPath<AppExitEvent>("程序退出时调用adlHelper.Close", LogEnum.None, message => { adlHelper.Close(); }, this.GetType()); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { var atiGpu = adlHelper.GetAtiGPU(i); string name = atiGpu.AdapterName; // short gpu name if (!string.IsNullOrEmpty(name)) { name = name.Replace("Radeon (TM) RX ", string.Empty); name = name.Replace("Radeon RX ", string.Empty); } var gpu = Gpu.Create(GpuType.AMD, i, atiGpu.BusNumber.ToString(), name); gpu.TotalMemory = adlHelper.GetTotalMemory(i); _gpus.Add(i, gpu); } if (deviceCount > 0) { this._driverVersion = adlHelper.GetDriverVersion(); this.Properties.Add(new GpuSetProperty(GpuSetProperty.DRIVER_VERSION, "驱动版本", DriverVersion)); const ulong minG = 5 * NTKeyword.ULongG; bool has470 = _gpus.Any(a => a.Key != NTMinerContext.GpuAllId && a.Value.TotalMemory < minG); if (has470) { Dictionary<string, string> kvs = new Dictionary<string, string> { ["GPU_MAX_ALLOC_PERCENT"] = "100", ["GPU_MAX_HEAP_SIZE"] = "100", ["GPU_SINGLE_ALLOC_PERCENT"] = "100" }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerContext.GpuAllId); foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } else { Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerContext.GpuAllId); }); } } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public MinerProfileIndex() { #if DEBUG NTStopwatch.Start(); #endif InitializeComponent(); this.PopupKernel.Closed += Popup_Closed; this.PopupMainCoinPool.Closed += Popup_Closed; this.PopupMainCoin.Closed += Popup_Closed; this.PopupMainCoinWallet.Closed += Popup_Closed; this.RunOneceOnLoaded((window) => { window.AddEventPath <ServerContextVmsReInitedEvent>("上下文视图模型集刷新后刷新界面上的popup", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { if (Vm.MinerProfile.MineWork != null) { return; } if (this.PopupKernel.Child != null && this.PopupKernel.IsOpen) { this.PopupKernel.IsOpen = false; OpenKernelPopup(); } if (this.PopupMainCoinPool.Child != null && this.PopupMainCoinPool.IsOpen) { this.PopupMainCoinPool.IsOpen = false; OpenMainCoinPoolPopup(); } if (this.PopupMainCoinPool1.Child != null && this.PopupMainCoinPool1.IsOpen) { this.PopupMainCoinPool1.IsOpen = false; OpenMainCoinPool1Popup(); } if (this.PopupMainCoin != null && this.PopupMainCoin.IsOpen) { this.PopupMainCoin.IsOpen = false; OpenMainCoinPopup(); } if (this.PopupMainCoinWallet != null && this.PopupMainCoinWallet.IsOpen) { this.PopupMainCoinWallet.IsOpen = false; OpenMainCoinWalletPopup(); } }); }, location: this.GetType()); }); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
static void Main(string[] args) { var t = new NTStopwatch(); t.Start(); var h = new NTH1F("hi", "there", 10, 0.0, 100.0); for (int i = 0; i < 100000000; i++) { h.Fill(10); } t.Stop(); h.Print(); t.Print(); }
private static bool NvmlInit() { if (_isNvmlInited) { return(_isNvmlInited); } lock (_locker) { if (_isNvmlInited) { return(_isNvmlInited); } try { #if DEBUG NTStopwatch.Start(); #endif if (!Directory.Exists(_nvsmiDir)) { Directory.CreateDirectory(_nvsmiDir); } if (!File.Exists(_nvmlDllFileFullName) && File.Exists(_nvmlDllFileFullName2)) { File.Copy(_nvmlDllFileFullName2, _nvmlDllFileFullName); } NvmlNativeMethods.SetDllDirectory(_nvsmiDir); var nvmlReturn = NvmlNativeMethods.nvmlInit(); NvmlNativeMethods.SetDllDirectory(null); _isNvmlInited = nvmlReturn == nvmlReturn.Success; // 没什么用,做个防御 if (!_isNvmlInited) { _nvmlInitFailCount++; if (_nvmlInitFailCount >= 10) { _isNvmlInited = true; } } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {nameof(NvmlHelper)}.{nameof(NvmlInit)}()"); } #endif return(_isNvmlInited); } catch (Exception e) { Logger.ErrorDebugLine(e); } return(false); } }
private NTMinerWalletViewModels() { #if DEBUG NTStopwatch.Start(); #endif if (WpfUtil.IsInDesignMode) { return; } Init(refresh: false); AppRoot.AddEventPath <NTMinerWalletSetInitedEvent>("NTMiner钱包集初始化后", LogEnum.DevConsole, action: message => { Init(refresh: true); }, location: this.GetType()); this.Add = new DelegateCommand(() => { new NTMinerWalletViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add); }); AppRoot.AddEventPath <NTMinerWalletAddedEvent>("添加NTMiner钱包后刷新VM内存", LogEnum.DevConsole, action: message => { if (!_dicById.ContainsKey(message.Source.GetId())) { _dicById.Add(message.Source.GetId(), new NTMinerWalletViewModel(message.Source)); if (AppRoot.CoinVms.TryGetCoinVm(message.Source.CoinCode, out CoinViewModel coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.NTMinerWallets)); } } }, location: this.GetType()); AppRoot.AddEventPath <NTMinerWalletUpdatedEvent>("更新NTMiner钱包后刷新VM内存", LogEnum.DevConsole, action: message => { if (_dicById.TryGetValue(message.Source.GetId(), out NTMinerWalletViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); AppRoot.AddEventPath <NTMinerWalletRemovedEvent>("删除NTMiner钱包后刷新VM内存", LogEnum.DevConsole, action: message => { _dicById.Remove(message.Source.GetId()); if (AppRoot.CoinVms.TryGetCoinVm(message.Source.CoinCode, out CoinViewModel coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.NTMinerWallets)); } }, location: this.GetType()); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public MinerProfileIndex() { if (WpfUtil.IsInDesignMode) { return; } #if DEBUG NTStopwatch.Start(); #endif this.Vm = new MinerProfileIndexViewModel(); this.DataContext = this.Vm; InitializeComponent(); this.OnLoaded(window => { window.BuildEventPath <LocalContextReInitedEventHandledEvent>("上下文视图模型集刷新后刷新界面上的popup", LogEnum.DevConsole, location: this.GetType(), PathPriority.Normal, path: message => { UIThread.Execute(() => { if (Vm.MinerProfile.MineWork != null) { return; } if (this.PopupKernel.Child != null && this.PopupKernel.IsOpen) { OpenKernelPopup(); } if (this.PopupMainCoinPool.Child != null && this.PopupMainCoinPool.IsOpen) { OpenMainCoinPoolPopup(); } if (this.PopupMainCoinPool1.Child != null && this.PopupMainCoinPool1.IsOpen) { OpenMainCoinPool1Popup(); } if (this.PopupMainCoin != null && this.PopupMainCoin.IsOpen) { OpenMainCoinPopup(); } if (this.PopupMainCoinWallet != null && this.PopupMainCoinWallet.IsOpen) { OpenMainCoinWalletPopup(); } }); }); }); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public void LoadGpuState() { #if DEBUG NTStopwatch.Start(); #endif for (int i = 0; i < Count; i++) { LoadGpuState(i); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.{nameof(LoadGpuState)}"); } #endif }
private GpuStatusBarViewModel() { #if DEBUG NTStopwatch.Start(); #endif this.GpuAllVm = AppContext.Instance.GpuVms.Items.FirstOrDefault(a => a.Index == NTMinerRoot.GpuAllId); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public void TestMethod2() { int secondCount = 1000000; NTStopwatch.Start(); A(secondCount, out int count1); var elapsedMilliseconds = NTStopwatch.Stop(); Console.WriteLine("A " + elapsedMilliseconds); NTStopwatch.Start(); B(secondCount, out int count2); elapsedMilliseconds = NTStopwatch.Stop(); Console.WriteLine("B " + elapsedMilliseconds); Assert.AreEqual(count1, count2); }
private OverClockDataViewModels() { #if DEBUG NTStopwatch.Start(); #endif if (WpfUtil.IsInDesignMode) { return; } Init(refresh: false); AppRoot.AddEventPath <OverClockDataSetInitedEvent>("超频菜谱集初始化后", LogEnum.DevConsole, action: message => { Init(refresh: true); }, location: this.GetType()); AppRoot.AddEventPath <OverClockDataAddedEvent>("添加超频菜谱后刷新VM内存", LogEnum.DevConsole, action: message => { if (!_dicById.ContainsKey(message.Source.GetId())) { _dicById.Add(message.Source.GetId(), new OverClockDataViewModel(message.Source)); if (AppRoot.CoinVms.TryGetCoinVm(message.Source.CoinId, out CoinViewModel coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.OverClockDatas)); } } }, location: this.GetType()); AppRoot.AddEventPath <OverClockDataUpdatedEvent>("更新超频菜谱后刷新VM内存", LogEnum.DevConsole, action: message => { if (_dicById.TryGetValue(message.Source.GetId(), out OverClockDataViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); AppRoot.AddEventPath <OverClockDataRemovedEvent>("删除超频菜谱后刷新VM内存", LogEnum.DevConsole, action: message => { _dicById.Remove(message.Source.GetId()); if (AppRoot.CoinVms.TryGetCoinVm(message.Source.CoinId, out CoinViewModel coinVm)) { coinVm.OnPropertyChanged(nameof(coinVm.OverClockDatas)); } }, location: this.GetType()); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
static void Main(string[] args) { var t = new NTStopwatch(); var h = new NTH1F("hi", "there", 10, 0.0, 100.0); h.Fill(4); var a = h.GetXaxis(); string newname = "fork"; t.Start(); for (int i = 0; i < 30000; i++) { a.SetBinLabel(3, newname); } t.Stop(); t.Print(); }
public void RegexPerfomanceTest() { string text = @"11:55:42:201 384 ETH: GPU0 14.015 Mh/s, GPU1 21.048 Mh/s"; NTStopwatch.Start(); Regex regex = new Regex(@"GPU(?<gpu>\d+) (?<gpuSpeed>[\d\.]+) (?<gpuSpeedUnit>.+?/s)"); for (int i = 0; i < 100; i++) { MatchCollection matches = regex.Matches(text); foreach (Match match in matches) { var a = match.Groups["gpu"]; var b = match.Groups["gpuSpeed"]; var c = match.Groups["gpuSpeedUnit"]; var d = match.Groups["notexit"]; } } var elapsedMilliseconds = NTStopwatch.Stop(); Console.WriteLine($"非编译:耗时{elapsedMilliseconds}"); string pattern = @"GPU(?<gpu>\d+) (?<gpuSpeed>[\d\.]+) (?<gpuSpeedUnit>.+?/s)"; for (int i = 0; i < 1000; i++) { VirtualRoot.GetRegex(Guid.NewGuid().ToString()); } NTStopwatch.Start(); for (int i = 0; i < 100; i++) { MatchCollection matches = VirtualRoot.GetRegex(pattern).Matches(text); foreach (Match match in matches) { var a = match.Groups["gpu"]; var b = match.Groups["gpuSpeed"]; var c = match.Groups["gpuSpeedUnit"]; var d = match.Groups["notexit"]; } } elapsedMilliseconds = NTStopwatch.Stop(); Console.WriteLine($"编译 :耗时{elapsedMilliseconds}"); }
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("挖矿内核启动失败,请联系开发人员解决"); } } }); }
/// <summary> /// 获取NTMiner所支持的所有内核的近处名 /// </summary> /// <param name="kernelSet"></param> /// <returns></returns> public static HashSet <string> GetAllKernelProcessNames(this IKernelSet kernelSet) { #if DEBUG NTStopwatch.Start(); #endif HashSet <string> hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var kernel in kernelSet.AsEnumerable()) { hashSet.Add(kernel.GetProcessName()); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {nameof(KernelSetExtension)}.{nameof(GetAllKernelProcessNames)}()"); } #endif return(hashSet); }
private CoinSnapshotDataViewModels() { if (WpfUtil.IsInDesignMode) { return; } #if DEBUG NTStopwatch.Start(); #endif foreach (var coinVm in AppRoot.CoinVms.AllCoins) { _dicByCoinCode.Add(coinVm.Code, new CoinSnapshotDataViewModel(CoinSnapshotData.CreateEmpty(coinVm.Code))); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
static void Main(string[] args) { var t = new NTStopwatch(); t.Start(); var filename = @"C:\Users\gordo\Documents\GRIDDS\user.emma.mc15_13TeV.361023.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ3W.merge.DAOD_EXOT15.e3668_s2576_s2132_r7773_r7676_p2952.v201\copied\ntuples_QCD_JZ3__0_addFullEtaMLP.root"; var tree = ROOTData.QueryablerecoTree.CreateQueriable(new FileInfo(filename)); tree.IgnoreQueryCache = true; using (var f = new FutureTFile(new FileInfo("../../../../01.root"))) { tree .Select(e => e.event_HTMiss) .Plot("met", "MET; Missing H_{T} [GeV]", 100, 0.0, 500.0) .Save(f); } t.Stop(); t.Print(); WriteLine("done"); }
private void Init() { #if DEBUG NTStopwatch.Start(); #endif lock (_locker) { if (!_isInited) { _isInited = true; _localIps = GetLocalIps(); VirtualRoot.RaiseEvent(new LocalIpSetInitedEvent()); } } #if DEBUG // 将近300毫秒 var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.{nameof(Init)}"); } #endif }
private static bool NvmlInit() { if (_isNvmlInited) { return(_isNvmlInited); } lock (_locker) { if (_isNvmlInited) { return(_isNvmlInited); } try { #if DEBUG NTStopwatch.Start(); #endif if (!File.Exists(_system32nvmlDllFileFullName) && File.Exists(_nvmlDllFileFullName)) { File.Copy(_nvmlDllFileFullName, _system32nvmlDllFileFullName); } var nvmlReturn = NvmlNativeMethods.NvmlInit(); _isNvmlInited = nvmlReturn == nvmlReturn.Success; #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {nameof(NvmlHelper)}.{nameof(NvmlInit)}()"); } #endif return(_isNvmlInited); } catch (Exception e) { Logger.ErrorDebugLine(e); _isNvmlInited = true; } return(false); } }
private void OverClock(INTMinerContext root, IGpuProfile data) { #if DEBUG NTStopwatch.Start(); #endif if (root.GpuSet.TryGetGpu(data.Index, out IGpu gpu)) { IOverClock overClock = root.GpuSet.OverClock; if (!data.IsAutoFanSpeed) { overClock.SetFanSpeed(data.Index, data.Cool); } overClock.SetCoreClock(data.Index, data.CoreClockDelta, data.CoreVoltage); overClock.SetMemoryClock(data.Index, data.MemoryClockDelta, data.MemoryVoltage); overClock.SetPowerLimit(data.Index, data.PowerCapacity); overClock.SetTempLimit(data.Index, data.TempLimit); if (data.Index == NTMinerContext.GpuAllId) { NTMinerConsole.UserOk($"统一超频:{data.ToOverClockString()}"); } else { NTMinerConsole.UserOk($"GPU{gpu.Index}超频:{data.ToOverClockString()}"); } 1.SecondsDelay().ContinueWith(t => { overClock.RefreshGpuState(data.Index); }); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.OverClock"); } #endif }
public MinerProfileViewModel() { #if DEBUG NTStopwatch.Start(); #endif if (WpfUtil.IsInDesignMode) { return; } if (Instance != null) { throw new InvalidProgramException(); } if (this.IsCreateShortcut) { CreateShortcut(); } this.Up = new DelegateCommand <string>(propertyName => { PropertyInfo propertyInfo = this.GetType().GetProperty(propertyName); if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(int)) { propertyInfo.SetValue(this, (int)propertyInfo.GetValue(this, null) + 1, null); } else if (propertyInfo.PropertyType == typeof(double)) { propertyInfo.SetValue(this, Math.Round((double)propertyInfo.GetValue(this, null) + 0.1, 2), null); } } else { Write.DevError($"类型{this.GetType().FullName}不具有名称为{propertyName}的属性"); } }); this.Down = new DelegateCommand <string>(propertyName => { PropertyInfo propertyInfo = this.GetType().GetProperty(propertyName); if (propertyInfo != null) { if (propertyInfo.PropertyType == typeof(int)) { int value = (int)propertyInfo.GetValue(this, null); if (value > 0) { propertyInfo.SetValue(this, value - 1, null); } } else if (propertyInfo.PropertyType == typeof(double)) { double value = (double)propertyInfo.GetValue(this, null); if (value > 0.1) { propertyInfo.SetValue(this, Math.Round(value - 0.1, 2), null); } } } else { Write.DevError($"类型{this.GetType().FullName}不具有名称为{propertyName}的属性"); } }); NTMinerRoot.SetRefreshArgsAssembly(() => { #if DEBUG NTStopwatch.Start(); #endif if (CoinVm != null && CoinVm.CoinKernel != null && CoinVm.CoinKernel.Kernel != null) { var coinKernelProfile = CoinVm.CoinKernel.CoinKernelProfile; var kernelInput = CoinVm.CoinKernel.Kernel.KernelInputVm; if (coinKernelProfile != null && kernelInput != null) { if (coinKernelProfile.IsDualCoinEnabled && !kernelInput.IsAutoDualWeight) { if (coinKernelProfile.DualCoinWeight > kernelInput.DualWeightMax) { coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMax; } else if (coinKernelProfile.DualCoinWeight < kernelInput.DualWeightMin) { coinKernelProfile.DualCoinWeight = kernelInput.DualWeightMin; } NTMinerRoot.Instance.MinerProfile.SetCoinKernelProfileProperty(coinKernelProfile.CoinKernelId, nameof(coinKernelProfile.DualCoinWeight), coinKernelProfile.DualCoinWeight); } } } NTMinerRoot.Instance.CurrentMineContext = NTMinerRoot.Instance.CreateMineContext(); if (NTMinerRoot.Instance.CurrentMineContext != null) { this.ArgsAssembly = NTMinerRoot.Instance.CurrentMineContext.CommandLine; } else { this.ArgsAssembly = string.Empty; } #if DEBUG var milliseconds = NTStopwatch.Stop(); if (milliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{milliseconds} {this.GetType().Name}.SetRefreshArgsAssembly"); } #endif }); VirtualRoot.AddEventPath <ServerContextVmsReInitedEvent>("ServerContext的VM集刷新后刷新视图界面", LogEnum.DevConsole, action: message => { OnPropertyChanged(nameof(CoinVm)); }, location: this.GetType()); AppContext.AddCmdPath <RefreshAutoBootStartCommand>("刷新开机启动和自动挖矿的展示", LogEnum.DevConsole, action: message => { MinerProfileData data = NTMinerRoot.CreateLocalRepository <MinerProfileData>().GetByKey(this.Id); if (data != null) { this.IsAutoBoot = data.IsAutoBoot; this.IsAutoStart = data.IsAutoStart; } }, location: this.GetType()); AppContext.AddEventPath <MinerProfilePropertyChangedEvent>("MinerProfile设置变更后刷新VM内存", LogEnum.DevConsole, action: message => { OnPropertyChanged(message.PropertyName); }, location: this.GetType()); VirtualRoot.AddEventPath <LocalContextVmsReInitedEvent>("本地上下文视图模型集刷新后刷新界面", LogEnum.DevConsole, action: message => { AllPropertyChanged(); if (CoinVm != null) { CoinVm.OnPropertyChanged(nameof(CoinVm.Wallets)); CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.OnPropertyChanged(nameof(CoinVm.Wallets)); CoinVm.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedWallet)); CoinVm.CoinKernel?.CoinKernelProfile.SelectedDualCoin?.CoinProfile.OnPropertyChanged(nameof(CoinVm.CoinProfile.SelectedDualCoinWallet)); } }, location: this.GetType()); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public StateBar() { #if DEBUG NTStopwatch.Start(); #endif InitializeComponent(); if (WpfUtil.IsInDesignMode) { return; } this.RunOneceOnLoaded((window) => { window.Activated += (object sender, EventArgs e) => { Vm.OnPropertyChanged(nameof(Vm.IsAutoAdminLogon)); Vm.OnPropertyChanged(nameof(Vm.AutoAdminLogonToolTip)); Vm.OnPropertyChanged(nameof(Vm.IsRemoteDesktopEnabled)); Vm.OnPropertyChanged(nameof(Vm.RemoteDesktopToolTip)); }; window.AddEventPath <LocalIpSetInitedEvent>("本机IP集刷新后刷新状态栏", LogEnum.DevConsole, action: message => { UIThread.Execute(() => Vm.RefreshLocalIps()); }, location: this.GetType()); window.AddEventPath <MinutePartChangedEvent>("时间的分钟部分变更过更新计时器显示", LogEnum.None, action: message => { UIThread.Execute(() => { Vm.UpdateDateTime(); }); }, location: this.GetType()); window.AddEventPath <Per1SecondEvent>("挖矿计时秒表", LogEnum.None, action: message => { UIThread.Execute(() => { DateTime now = DateTime.Now; Vm.UpdateBootTimeSpan(now - NTMinerRoot.Instance.CreatedOn); var mineContext = NTMinerRoot.Instance.LockedMineContext; if (mineContext != null) { Vm.UpdateMineTimeSpan(now - mineContext.CreatedOn); } }); }, location: this.GetType()); window.AddEventPath <AppVersionChangedEvent>("发现了服务端新版本", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.SetCheckUpdateForeground(isLatest: EntryAssemblyInfo.CurrentVersion >= NTMinerRoot.ServerVersion); }); }, location: this.GetType()); window.AddEventPath <KernelSelfRestartedEvent>("内核自我重启时刷新计数器", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.OnPropertyChanged(nameof(Vm.KernelSelfRestartCountText)); }); }, location: this.GetType()); window.AddEventPath <MineStartedEvent>("挖矿开始后将内核自我重启计数清零", LogEnum.DevConsole, action: message => { UIThread.Execute(() => { Vm.OnPropertyChanged(nameof(Vm.KernelSelfRestartCountText)); }); }, location: this.GetType()); }); var gpuSet = NTMinerRoot.Instance.GpuSet; // 建议每张显卡至少对应4G虚拟内存,否则标红 if (NTMinerRoot.OSVirtualMemoryMb < gpuSet.Count * 4) { BtnShowVirtualMemory.Foreground = WpfUtil.RedBrush; } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
private MinerGroupViewModels() { #if DEBUG NTStopwatch.Start(); #endif if (WpfUtil.IsInDesignMode) { return; } foreach (var item in NTMinerContext.Instance.MinerStudioContext.MinerGroupSet.AsEnumerable()) { if (!_dicById.ContainsKey(item.Id)) { _dicById.Add(item.Id, new MinerGroupViewModel(item)); } } AppRoot.AddEventPath <MinerGroupSetInitedEvent>("矿工组集初始化后初始化Vm内存", LogEnum.DevConsole, action: message => { foreach (var item in NTMinerContext.Instance.MinerStudioContext.MinerGroupSet.AsEnumerable()) { if (!_dicById.ContainsKey(item.Id)) { _dicById.Add(item.Id, new MinerGroupViewModel(item)); } } this.OnPropertyChangeds(); MinerClientsWindowViewModel.Instance.RefreshMinerClientsSelectedMinerGroup(MinerClientsWindowViewModel.Instance.MinerClients.ToArray()); }, this.GetType()); this.Add = new DelegateCommand(() => { new MinerGroupViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add); }); AppRoot.AddEventPath <MinerGroupAddedEvent>("添加矿机分组后刷新VM内存", LogEnum.DevConsole, action: message => { if (!_dicById.TryGetValue(message.Source.GetId(), out MinerGroupViewModel vm)) { vm = new MinerGroupViewModel(message.Source); _dicById.Add(message.Source.GetId(), vm); OnPropertyChangeds(); MinerClientsWindowVm.OnPropertyChanged(nameof(MinerClientsWindowViewModel.SelectedMinerGroup)); } }, location: this.GetType()); AppRoot.AddEventPath <MinerGroupUpdatedEvent>("添加矿机分组后刷新VM内存", LogEnum.DevConsole, action: message => { if (_dicById.TryGetValue(message.Source.GetId(), out MinerGroupViewModel vm)) { vm.Update(message.Source); } }, location: this.GetType()); AppRoot.AddEventPath <MinerGroupRemovedEvent>("移除了矿机组后刷新Vm内容", LogEnum.DevConsole, action: message => { if (_dicById.TryGetValue(message.Source.Id, out MinerGroupViewModel vm)) { _dicById.Remove(vm.Id); OnPropertyChangeds(); MinerClientsWindowVm.OnPropertyChanged(nameof(MinerClientsWindowViewModel.SelectedMinerGroup)); } }, this.GetType()); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public AMDGpuSet() { #if DEBUG NTStopwatch.Start(); #endif adlHelper.Init(); this.Properties = new List <GpuSetProperty>(); this.OverClock = new GpuOverClock(adlHelper); int deviceCount = 0; deviceCount = adlHelper.GpuCount; for (int i = 0; i < deviceCount; i++) { var atiGpu = adlHelper.GetGpuName(i); string name = atiGpu.AdapterName; // short gpu name if (!string.IsNullOrEmpty(name)) { name = name.Replace("Radeon (TM) RX ", string.Empty); name = name.Replace("Radeon RX ", string.Empty); } var gpu = Gpu.Create(i, atiGpu.BusNumber.ToString(), name); gpu.TotalMemory = adlHelper.GetTotalMemory(i); _gpus.Add(i, gpu); } if (deviceCount > 0) { this.DriverVersion = adlHelper.GetDriverVersion(); this.Properties.Add(new GpuSetProperty(GpuSetProperty.DRIVER_VERSION, "驱动版本", DriverVersion)); const ulong minG = (ulong)5 * 1024 * 1024 * 1024; bool has470 = _gpus.Any(a => a.Key != NTMinerRoot.GpuAllId && a.Value.TotalMemory < minG); if (has470) { Dictionary <string, string> kvs = new Dictionary <string, string> { { "GPU_MAX_ALLOC_PERCENT", "100" }, { "GPU_MAX_HEAP_SIZE", "100" }, { "GPU_SINGLE_ALLOC_PERCENT", "100" } }; foreach (var kv in kvs) { var property = new GpuSetProperty(kv.Key, kv.Key, kv.Value); this.Properties.Add(property); } Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerRoot.GpuAllId); foreach (var kv in kvs) { Environment.SetEnvironmentVariable(kv.Key, kv.Value); } }); } else { Task.Factory.StartNew(() => { OverClock.RefreshGpuState(NTMinerRoot.GpuAllId); }); } } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
private ColumnsShowViewModels() { if (WpfUtil.IsInDesignMode) { return; } #if DEBUG NTStopwatch.Start(); #endif this.Add = new DelegateCommand(() => { WpfUtil.ShowInputDialog("列分组名称", string.Empty, string.Empty, columnsShowName => { if (string.IsNullOrEmpty(columnsShowName)) { return("列分组名称是必须的"); } return(string.Empty); }, onOk: columnsShowName => { ColumnsShowData entity = new ColumnsShowData { ColumnsShowName = columnsShowName, LastActivedOnText = true, BootTimeSpanText = true, MineTimeSpanText = true, Work = true, MinerGroup = true, MinerName = true, WorkerName = true, LocalIp = true, MinerIp = true, GpuType = true, MainCoinCode = true, MainCoinSpeedText = true, MainCoinRejectPercentText = true }; NTMinerContext.Instance.MinerStudioContext.ColumnsShowSet.AddOrUpdate(entity); }); }); AppRoot.AddEventPath <ColumnsShowAddedOrUpdatedEvent>("添加或修改了列分组后刷新VM内存", LogEnum.DevConsole, action: message => { if (!_dicById.TryGetValue(message.Source.GetId(), out ColumnsShowViewModel vm)) { vm = new ColumnsShowViewModel(message.Source); _dicById.Add(message.Source.GetId(), vm); OnPropertyChanged(nameof(List)); MinerClientsWindowVm.ColumnsShow = vm; } else { vm.Update(message.Source); } }, location: this.GetType()); AppRoot.AddEventPath <ColumnsRemovedEvent>("删除了列分组后刷新Vm内存", LogEnum.DevConsole, action: message => { if (_dicById.ContainsKey(message.Source.Id)) { _dicById.Remove(message.Source.Id); OnPropertyChanged(nameof(List)); if (_dicById.TryGetValue(ColumnsShowData.PleaseSelect.Id, out ColumnsShowViewModel vm)) { MinerClientsWindowVm.ColumnsShow = vm; } } }, this.GetType()); foreach (var item in NTMinerContext.Instance.MinerStudioContext.ColumnsShowSet.GetAll()) { _dicById.Add(item.Id, new ColumnsShowViewModel(item)); } #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { Write.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }
public MainWindow() { if (WpfUtil.IsInDesignMode) { return; } if (!NTMinerConsole.IsEnabled) { NTMinerConsole.Enable(); } this.Vm = new MainWindowViewModel(); this.DataContext = Vm; this.MinHeight = 430; this.MinWidth = 640; this.Width = AppRoot.MainWindowWidth; this.Height = AppRoot.MainWindowHeight; #if DEBUG NTStopwatch.Start(); #endif ConsoleWindow.Instance.MouseDown += (sender, e) => { MoveConsoleWindow(); }; SystemEvents.SessionSwitch += SystemEvents_SessionSwitch; this.Loaded += (sender, e) => { ConsoleTabItemTopBorder.Margin = new Thickness(0, ConsoleTabItem.ActualHeight - 1, 0, 0); MoveConsoleWindow(); hwndSource = PresentationSource.FromVisual((Visual)sender) as HwndSource; hwndSource.AddHook(new HwndSourceHook(Win32Proc.WindowProc)); }; InitializeComponent(); _leftDrawerGripWidth = LeftDrawerGrip.Width; _btnOverClockBackground = BtnOverClock.Background; // 下面几行是为了看见设计视图 this.ResizeCursors.Visibility = Visibility.Visible; this.HideLeftDrawerGrid(); // 上面几行是为了看见设计视图 DateTime lastGetServerMessageOn = DateTime.MinValue; // 切换了主界面上的Tab时 this.MainTabControl.SelectionChanged += (sender, e) => { // 延迟创建,以加快主界面的启动 #region var selectedItem = MainTabControl.SelectedItem; if (selectedItem == TabItemSpeedTable) { if (SpeedTableContainer.Child == null) { SpeedTableContainer.Child = GetSpeedTable(); } } else if (selectedItem == TabItemMessage) { if (MessagesContainer.Child == null) { MessagesContainer.Child = new Messages(); } } else if (selectedItem == TabItemToolbox) { if (ToolboxContainer.Child == null) { ToolboxContainer.Child = new Toolbox(); } } else if (selectedItem == TabItemMinerProfileOption) { if (MinerProfileOptionContainer.Child == null) { MinerProfileOptionContainer.Child = new MinerProfileOption(); } } RpcRoot.SetIsServerMessagesVisible(selectedItem == TabItemMessage); if (selectedItem == TabItemMessage) { if (lastGetServerMessageOn.AddSeconds(10) < DateTime.Now) { lastGetServerMessageOn = DateTime.Now; VirtualRoot.Execute(new LoadNewServerMessageCommand()); } } if (selectedItem == ConsoleTabItem) { ConsoleTabItemTopBorder.Visibility = Visibility.Visible; } else { ConsoleTabItemTopBorder.Visibility = Visibility.Collapsed; } #endregion }; this.IsVisibleChanged += (sender, e) => { #region if (this.IsVisible) { NTMinerContext.IsUiVisible = true; } else { NTMinerContext.IsUiVisible = false; } MoveConsoleWindow(); #endregion }; this.StateChanged += (s, e) => { #region if (Vm.MinerProfile.IsShowInTaskbar) { ShowInTaskbar = true; } else { if (WindowState == WindowState.Minimized) { ShowInTaskbar = false; } else { ShowInTaskbar = true; } } if (WindowState == WindowState.Maximized) { ResizeCursors.Visibility = Visibility.Collapsed; } else { ResizeCursors.Visibility = Visibility.Visible; } MoveConsoleWindow(); #endregion }; bool isLeftClosed = false; this.ConsoleRectangle.IsVisibleChanged += (sender, e) => { if (this.ConsoleRectangle.IsVisible) { if (isLeftClosed != (LeftDrawerGrip.Width == _leftDrawerGripWidth)) { ConsoleWindowFit(); } } else { isLeftClosed = LeftDrawerGrip.Width == _leftDrawerGripWidth; } }; this.ConsoleRectangle.SizeChanged += (s, e) => { MoveConsoleWindow(); }; if (this.Width < 860) { NTMinerConsole.UserWarn("左侧面板已折叠,可点击侧边的'开始挖矿'按钮展开。"); } this.SizeChanged += (s, e) => { #region if (this.Width < 860) { this.CloseLeftDrawer(); this.BtnAboutNTMiner.Visibility = Visibility.Collapsed; } else { this.OpenLeftDrawer(isSizeChanged: true); this.BtnAboutNTMiner.Visibility = Visibility.Visible; } if (!this.ConsoleRectangle.IsVisible) { if (e.WidthChanged) { ConsoleWindow.Instance.Width = e.NewSize.Width; } if (e.HeightChanged) { ConsoleWindow.Instance.Height = e.NewSize.Height; } } #endregion }; NotiCenterWindow.Bind(this, ownerIsTopmost: true); this.LocationChanged += (sender, e) => { MoveConsoleWindow(); }; VirtualRoot.BuildCmdPath <TopmostCommand>(path: message => { UIThread.Execute(() => { if (!this.Topmost) { this.Topmost = true; } }); }, this.GetType()); VirtualRoot.BuildCmdPath <UnTopmostCommand>(path: message => { UIThread.Execute(() => { if (this.Topmost) { this.Topmost = false; } }); }, this.GetType()); VirtualRoot.BuildCmdPath <CloseMainWindowCommand>(path: message => { UIThread.Execute(() => { if (message.IsAutoNoUi) { SwitchToNoUi(); } else { this.Close(); } }); }, location: this.GetType()); this.BuildEventPath <Per1MinuteEvent>("挖矿中时自动切换为无界面模式", LogEnum.DevConsole, path: message => { if (NTMinerContext.IsUiVisible && NTMinerContext.Instance.MinerProfile.IsAutoNoUi && NTMinerContext.Instance.IsMining) { if (NTMinerContext.MainWindowRendedOn.AddMinutes(NTMinerContext.Instance.MinerProfile.AutoNoUiMinutes) < message.BornOn) { VirtualRoot.ThisLocalInfo(nameof(MainWindow), $"挖矿中界面展示{NTMinerContext.Instance.MinerProfile.AutoNoUiMinutes}分钟后自动切换为无界面模式,可在选项页调整配置"); VirtualRoot.Execute(new CloseMainWindowCommand(isAutoNoUi: true)); } } }, location: this.GetType()); #if DEBUG var elapsedMilliseconds = NTStopwatch.Stop(); if (elapsedMilliseconds.ElapsedMilliseconds > NTStopwatch.ElapsedMilliseconds) { NTMinerConsole.DevTimeSpan($"耗时{elapsedMilliseconds} {this.GetType().Name}.ctor"); } #endif }