nttest 6 лет назад
Родитель
Сommit
17335ed7c9
44 измененных файлов с 134 добавлено и 112 удалено
  1. 2 2
      src/AppModels/AppContext.partials.CoinGroupViewModels.cs
  2. 2 2
      src/AppModels/AppContext.partials.CoinKernelViewModels.cs
  3. 2 2
      src/AppModels/AppContext.partials.CoinProfileViewModels.cs
  4. 2 2
      src/AppModels/AppContext.partials.CoinSnapshotDataViewModels.cs
  5. 2 2
      src/AppModels/AppContext.partials.CoinViewModels.cs
  6. 2 2
      src/AppModels/AppContext.partials.ColumnsShowViewModels.cs
  7. 2 2
      src/AppModels/AppContext.partials.DriveSetViewModel.cs
  8. 2 2
      src/AppModels/AppContext.partials.FileWriterViewModels.cs
  9. 2 2
      src/AppModels/AppContext.partials.FragmentWriterViewModels.cs
  10. 2 2
      src/AppModels/AppContext.partials.GpuProfileViewModels.cs
  11. 2 2
      src/AppModels/AppContext.partials.GpuSpeedViewModels.cs
  12. 2 2
      src/AppModels/AppContext.partials.GpuViewModels.cs
  13. 2 2
      src/AppModels/AppContext.partials.GroupViewModels.cs
  14. 2 2
      src/AppModels/AppContext.partials.KernelInputViewModels.cs
  15. 2 2
      src/AppModels/AppContext.partials.KernelOutputFilterViewModels.cs
  16. 2 2
      src/AppModels/AppContext.partials.KernelOutputTranslaterViewModels.cs
  17. 2 2
      src/AppModels/AppContext.partials.KernelOutputViewModels.cs
  18. 2 2
      src/AppModels/AppContext.partials.KernelViewModels.cs
  19. 2 2
      src/AppModels/AppContext.partials.MineWorkViewModels.cs
  20. 2 2
      src/AppModels/AppContext.partials.MinerGroupViewModels.cs
  21. 2 2
      src/AppModels/AppContext.partials.OverClockDataViewModels.cs
  22. 2 2
      src/AppModels/AppContext.partials.PackageViewModels.cs
  23. 2 2
      src/AppModels/AppContext.partials.PoolKernelViewModels.cs
  24. 2 2
      src/AppModels/AppContext.partials.PoolProfileViewModels.cs
  25. 2 2
      src/AppModels/AppContext.partials.PoolViewModels.cs
  26. 2 2
      src/AppModels/AppContext.partials.ShareViewModels.cs
  27. 2 2
      src/AppModels/AppContext.partials.SysDicItemViewModels.cs
  28. 2 2
      src/AppModels/AppContext.partials.SysDicViewModels.cs
  29. 2 2
      src/AppModels/AppContext.partials.UserViewModels.cs
  30. 2 2
      src/AppModels/AppContext.partials.WalletViewModels.cs
  31. 2 2
      src/AppModels/Vms/GpuStatusBarViewModel.cs
  32. 2 2
      src/AppModels/Vms/MinerProfileViewModel.cs
  33. 2 2
      src/AppModels/Vms/StartStopMineButtonViewModel.cs
  34. 2 2
      src/AppModels/Vms/VirtualMemorySetViewModel.cs
  35. 2 2
      src/AppViews0/MainWindow.xaml.cs
  36. 2 2
      src/AppViews0/SplashWindow.xaml.cs
  37. 4 4
      src/NTMiner.Core/Core/Gpus/Impl/AMDGpuSet.cs
  38. 2 2
      src/NTMiner.Core/Core/Kernels/KernelSetExtension.cs
  39. 2 2
      src/NTMiner.Core/Core/Profiles/GpuProfileSet.cs
  40. 2 2
      src/NTMiner.Core/NTMinerRoot.partials.MinerProcess.cs
  41. 5 14
      src/NTMinerGpus/Gpus/NvapiHelper.cs
  42. 42 12
      src/NTMinerGpus/Gpus/NvmlHelper.cs
  43. 3 0
      src/NTMinerLogging/Write.cs
  44. 2 4
      src/NTMinerlib/VirtualRoot.cs

+ 2 - 2
src/AppModels/AppContext.partials.CoinGroupViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
             private readonly Dictionary<Guid, List<CoinGroupViewModel>> _listByGroupId = new Dictionary<Guid, List<CoinGroupViewModel>>();
             private CoinGroupViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -59,7 +59,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.CoinKernelViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
             private readonly Dictionary<Guid, CoinKernelViewModel> _dicById = new Dictionary<Guid, CoinKernelViewModel>();
             private CoinKernelViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -82,7 +82,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.CoinProfileViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
 
             private CoinProfileViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 On<CoinKernelProfilePropertyChangedEvent>("币种内核设置变更后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -33,7 +33,7 @@ namespace NTMiner {
                         _coinProfileDicById.Clear();
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.CoinSnapshotDataViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private CoinSnapshotDataViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 foreach (var coinVm in AppContext.Instance.CoinVms.AllCoins) {
                     _dicByCoinCode.Add(coinVm.Code, new CoinSnapshotDataViewModel(new MinerServer.CoinSnapshotData {
@@ -28,7 +28,7 @@ namespace NTMiner {
                     }));
                 }
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.CoinViewModels.cs

@@ -14,7 +14,7 @@ namespace NTMiner {
 
             private CoinViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -88,7 +88,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.ColumnsShowViewModels.cs

@@ -16,7 +16,7 @@ namespace NTMiner {
 
             private ColumnsShowViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 this.Add = new DelegateCommand(() => {
                     new ColumnsShowViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add);
@@ -47,7 +47,7 @@ namespace NTMiner {
                     _dicById.Add(item.GetId(), new ColumnsShowViewModel(item));
                 }
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.DriveSetViewModel.cs

@@ -15,7 +15,7 @@ namespace NTMiner {
 
             private DriveSetViewModel() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 foreach (var item in DriveInfo.GetDrives().Where(a => a.DriveType == DriveType.Fixed)) {
                     _drives.Add(new DriveViewModel(item));
@@ -24,7 +24,7 @@ namespace NTMiner {
                     AppContext.Instance.VirtualMemorySetVm.SetVirtualMemoryOfDrive();
                 });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.FileWriterViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
             public ICommand Add { get; private set; }
             private FileWriterViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 this.Add = new DelegateCommand(() => {
                     new FileWriterViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add);
@@ -49,7 +49,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.FragmentWriterViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
             public ICommand Add { get; private set; }
             private FragmentWriterViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 this.Add = new DelegateCommand(() => {
                     new FragmentWriterViewModel(Guid.NewGuid()).Edit.Execute(FormType.Add);
@@ -49,7 +49,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.GpuProfileViewModels.cs

@@ -16,7 +16,7 @@ namespace NTMiner {
 
             private GpuProfileViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<GpuProfileSetRefreshedEvent>("Gpu超频集合刷新后刷新附着在当前币种上的超频数据", LogEnum.DevConsole,
                     action: message => {
@@ -65,7 +65,7 @@ namespace NTMiner {
                         }
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.GpuSpeedViewModels.cs

@@ -23,7 +23,7 @@ namespace NTMiner {
 
             private GpuSpeedViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -99,7 +99,7 @@ namespace NTMiner {
                         TotalSpeedVm.DualCoinSpeed.OnPropertyChanged(nameof(SpeedViewModel.LastSpeedOnText));
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.GpuViewModels.cs

@@ -18,7 +18,7 @@ namespace NTMiner {
             private readonly GpuViewModel _gpuAllVm;
             private GpuViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -93,7 +93,7 @@ namespace NTMiner {
                         }
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.GroupViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
             public ICommand Add { get; private set; }
             private GroupViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 this.Add = new DelegateCommand(() => {
                     new GroupViewModel(Guid.NewGuid()) {
@@ -56,7 +56,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.KernelInputViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private KernelInputViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -60,7 +60,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.KernelOutputFilterViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private KernelOutputFilterViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -53,7 +53,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.KernelOutputTranslaterViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
 
             private KernelOutputTranslaterViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -65,7 +65,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.KernelOutputViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private KernelOutputViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -49,7 +49,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.KernelViewModels.cs

@@ -17,7 +17,7 @@ namespace NTMiner {
 
             private KernelViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -63,7 +63,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.MineWorkViewModels.cs

@@ -14,7 +14,7 @@ namespace NTMiner {
 
             private MineWorkViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -50,7 +50,7 @@ namespace NTMiner {
                         }
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.MinerGroupViewModels.cs

@@ -15,7 +15,7 @@ namespace NTMiner {
 
             private MinerGroupViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -47,7 +47,7 @@ namespace NTMiner {
                         AppContext.Instance.MinerClientsWindowVm.OnPropertyChanged(nameof(MinerClientsWindowViewModel.SelectedMinerGroup));
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.OverClockDataViewModels.cs

@@ -13,7 +13,7 @@ namespace NTMiner {
 
             private OverClockDataViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -48,7 +48,7 @@ namespace NTMiner {
                         }
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.PackageViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private PackageViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -49,7 +49,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.PoolKernelViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
             private readonly Dictionary<Guid, PoolKernelViewModel> _dicById = new Dictionary<Guid, PoolKernelViewModel>();
             private PoolKernelViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 On<PoolKernelAddedEvent>("新添了矿池内核后刷新矿池内核VM内存", LogEnum.DevConsole,
                     action: (message) => {
@@ -43,7 +43,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.PoolProfileViewModels.cs

@@ -11,7 +11,7 @@ namespace NTMiner {
 
             private PoolProfileViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 On<PoolProfilePropertyChangedEvent>("矿池设置变更后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -24,7 +24,7 @@ namespace NTMiner {
                         _dicById.Clear();
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.PoolViewModels.cs

@@ -11,7 +11,7 @@ namespace NTMiner {
             private readonly Dictionary<Guid, PoolViewModel> _dicById = new Dictionary<Guid, PoolViewModel>();
             private PoolViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -52,7 +52,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.ShareViewModels.cs

@@ -11,7 +11,7 @@ namespace NTMiner {
 
             private ShareViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 On<ShareChangedEvent>("收益变更后调整VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -21,7 +21,7 @@ namespace NTMiner {
                         }
                     });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.SysDicItemViewModels.cs

@@ -12,7 +12,7 @@ namespace NTMiner {
 
             private SysDicItemViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -62,7 +62,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.SysDicViewModels.cs

@@ -15,7 +15,7 @@ namespace NTMiner {
             public ICommand Add { get; private set; }
             private SysDicViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<ServerContextReInitedEvent>("ServerContext刷新后刷新VM内存", LogEnum.DevConsole,
                     action: message => {
@@ -60,7 +60,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.UserViewModels.cs

@@ -14,7 +14,7 @@ namespace NTMiner {
 
             private UserViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 if (Design.IsInDesignMode) {
                     return;
@@ -48,7 +48,7 @@ namespace NTMiner {
                     _dicByLoginName.Add(item.LoginName, new UserViewModel(item));
                 }
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/AppContext.partials.WalletViewModels.cs

@@ -11,7 +11,7 @@ namespace NTMiner {
             private readonly Dictionary<Guid, WalletViewModel> _dicById = new Dictionary<Guid, WalletViewModel>();
             private WalletViewModels() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
                 VirtualRoot.On<LocalContextReInitedEvent>("LocalContext刷新后刷新钱包Vm内存", LogEnum.None,
                     action: message=> {
@@ -47,7 +47,7 @@ namespace NTMiner {
                     });
                 Init();
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
             }
 

+ 2 - 2
src/AppModels/Vms/GpuStatusBarViewModel.cs

@@ -7,11 +7,11 @@ namespace NTMiner.Vms {
 
         private GpuStatusBarViewModel() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
             this.GpuAllVm = AppContext.Instance.GpuVms.FirstOrDefault(a => a.Index == NTMinerRoot.GpuAllId);
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 2 - 2
src/AppModels/Vms/MinerProfileViewModel.cs

@@ -46,7 +46,7 @@ namespace NTMiner.Vms {
 
         public MinerProfileViewModel() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
             if (Design.IsInDesignMode) {
                 return;
@@ -197,7 +197,7 @@ namespace NTMiner.Vms {
                     }
                 });
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 2 - 2
src/AppModels/Vms/StartStopMineButtonViewModel.cs

@@ -12,7 +12,7 @@ namespace NTMiner.Vms {
                 return;
             }
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
             this.StartMine = new DelegateCommand(() => {
                 this.MinerProfile.IsMining = true;
@@ -47,7 +47,7 @@ namespace NTMiner.Vms {
                 });
             }
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 2 - 2
src/AppModels/Vms/VirtualMemorySetViewModel.cs

@@ -13,7 +13,7 @@ namespace NTMiner.Vms {
         private readonly Dictionary<string, VirtualMemoryViewModel> _initialVms = new Dictionary<string, VirtualMemoryViewModel>(StringComparer.OrdinalIgnoreCase);
         private VirtualMemorySetViewModel() {
 #if DEBUG
-                VirtualRoot.Stopwatch.Restart();
+                Write.Stopwatch.Restart();
 #endif
             foreach (var item in GetPagingFiles()) {
                 _initialVms.Add(item.DriveName, item);
@@ -28,7 +28,7 @@ namespace NTMiner.Vms {
             }
             NTMinerRoot.OSVirtualMemoryMb = _dic.Values.Sum(a => a.MaxSizeMb);
 #if DEBUG
-                Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+                Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 2 - 2
src/AppViews0/MainWindow.xaml.cs

@@ -17,7 +17,7 @@ namespace NTMiner.Views {
 
         public MainWindow() {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             UIThread.StartTimer();
             InitializeComponent();
@@ -94,7 +94,7 @@ namespace NTMiner.Views {
                     Vm.RefreshDaemonStateBrush();
                 });
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 2 - 2
src/AppViews0/SplashWindow.xaml.cs

@@ -12,11 +12,11 @@ namespace NTMiner.Views {
 
         public SplashWindow() {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             InitializeComponent();
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 

+ 4 - 4
src/NTMiner.Core/Core/Gpus/Impl/AMDGpuSet.cs

@@ -28,7 +28,7 @@ namespace NTMiner.Core.Gpus.Impl {
         private readonly AdlHelper adlHelper = new AdlHelper();
         public AMDGpuSet(INTMinerRoot root) : this() {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             _root = root;
             adlHelper.Init();
@@ -78,13 +78,13 @@ namespace NTMiner.Core.Gpus.Impl {
                 }
             }
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.ctor");
 #endif
         }
 
         public void LoadGpuState() {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             for (int i = 0; i < Count; i++) {
                 uint power = adlHelper.GetPowerUsageByIndex(i);
@@ -102,7 +102,7 @@ namespace NTMiner.Core.Gpus.Impl {
                 }
             }
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.{nameof(LoadGpuState)}");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.{nameof(LoadGpuState)}");
 #endif
         }
 

+ 2 - 2
src/NTMiner.Core/Core/Kernels/KernelSetExtension.cs

@@ -10,14 +10,14 @@ namespace NTMiner.Core.Kernels {
         /// <returns></returns>
         public static HashSet<string> GetAllKernelProcessNames(this IKernelSet kernelSet) {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
             foreach (var kernel in kernelSet) {
                 hashSet.Add(kernel.GetProcessName());
             }
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(KernelSetExtension)}.{nameof(GetAllKernelProcessNames)}()");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(KernelSetExtension)}.{nameof(GetAllKernelProcessNames)}()");
 #endif
             return hashSet;
         }

+ 2 - 2
src/NTMiner.Core/Core/Profiles/GpuProfileSet.cs

@@ -97,7 +97,7 @@ namespace NTMiner.Core.Profiles {
 
         private void OverClock(INTMinerRoot root, IGpuProfile data) {
 #if DEBUG
-            VirtualRoot.Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             if (root.GpuSet.TryGetGpu(data.Index, out IGpu gpu)) {
                 IOverClock overClock = root.GpuSet.OverClock;
@@ -125,7 +125,7 @@ namespace NTMiner.Core.Profiles {
                 overClock.RefreshGpuState(data.Index);
             }
 #if DEBUG
-            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.OverClock");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {this.GetType().Name}.OverClock");
 #endif
         }
 

+ 2 - 2
src/NTMiner.Core/NTMinerRoot.partials.MinerProcess.cs

@@ -22,12 +22,12 @@ namespace NTMiner {
                         try {
                             Write.UserInfo("清理内核进程");
 #if DEBUG
-                            VirtualRoot.Stopwatch.Restart();
+                            Write.Stopwatch.Restart();
 #endif
                             // 清理除当前外的Temp/Kernel
                             Cleaner.Clear();
 #if DEBUG
-                            Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(MinerProcess)}.{nameof(CreateProcessAsync)}[{nameof(Cleaner)}.{nameof(Cleaner.Clear)}]");
+                            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(MinerProcess)}.{nameof(CreateProcessAsync)}[{nameof(Cleaner)}.{nameof(Cleaner.Clear)}]");
 #endif
                             Write.UserOk("内核进程清理完毕");
                             // 应用超频

+ 5 - 14
src/NTMinerGpus/Gpus/NvapiHelper.cs

@@ -5,6 +5,9 @@ using System.Runtime.InteropServices;
 
 namespace NTMiner.Gpus {
     public class NvapiHelper {
+        private const int VERSION1 = 1 << 16;
+        private const int VERSION2 = 2 << 16;
+
         public NvapiHelper() { }
 
         private static Dictionary<int, NvPhysicalGpuHandle> _handlesByBusId = null;
@@ -304,8 +307,6 @@ namespace NTMiner.Gpus {
             return hasSetValue;
         }
 
-        private const int VERSION1 = 1 << 16;
-        private const int VERSION2 = 2 << 16;
         private NV_GPU_PERF_PSTATES20_INFO_V1 NvGetPStateV1(int busId) {
             NV_GPU_PERF_PSTATES20_INFO_V1 info = new NV_GPU_PERF_PSTATES20_INFO_V1();
             try {
@@ -585,20 +586,10 @@ namespace NTMiner.Gpus {
             return false;
         }
 
-        private static T allocStruct<T>() {
-            int size = Marshal.SizeOf(typeof(T));
-            byte[] bytes = new byte[size];
-            Array.Clear(bytes, 0, size);
-            IntPtr structPtr = Marshal.AllocHGlobal(size);
-            object obj = Marshal.PtrToStructure(structPtr, typeof(T));
-            Marshal.FreeHGlobal(structPtr);
-            return (T)obj;
-        }
-
         private bool SetCoolerLevels(int busId, uint value) {
             NV_COOLER_TARGET coolerIndex = NV_COOLER_TARGET.NVAPI_COOLER_TARGET_ALL;
             try {
-                NVAPI_COOLER_LEVEL level = allocStruct<NVAPI_COOLER_LEVEL>();
+                NVAPI_COOLER_LEVEL level = new NVAPI_COOLER_LEVEL();
                 level.coolers[0].currentLevel = value;
                 level.coolers[0].currentPolicy = NV_COOLER_POLICY.NVAPI_COOLER_POLICY_MANUAL;
 
@@ -612,7 +603,7 @@ namespace NTMiner.Gpus {
         private bool SetCoolerLevelsAuto(int busId) {
             NV_COOLER_TARGET coolerIndex = NV_COOLER_TARGET.NVAPI_COOLER_TARGET_ALL;
             try {
-                NVAPI_COOLER_LEVEL level = allocStruct<NVAPI_COOLER_LEVEL>();
+                NVAPI_COOLER_LEVEL level = new NVAPI_COOLER_LEVEL();
                 level.coolers[0].currentLevel = 0;
                 level.coolers[0].currentPolicy = NV_COOLER_POLICY.NVAPI_COOLER_POLICY_AUTO;
                 return SetCoolerLevels(busId, coolerIndex, ref level);

+ 42 - 12
src/NTMinerGpus/Gpus/NvmlHelper.cs

@@ -40,7 +40,7 @@ namespace NTMiner.Gpus {
                 }
                 try {
 #if DEBUG
-                        VirtualRoot.Stopwatch.Restart();
+                    Write.Stopwatch.Restart();
 #endif
                     if (!Directory.Exists(_nvsmiDir)) {
                         Directory.CreateDirectory(_nvsmiDir);
@@ -53,7 +53,7 @@ namespace NTMiner.Gpus {
                     NvmlNativeMethods.SetDllDirectory(null);
                     _isNvmlInited = nvmlReturn == nvmlReturn.Success;
 #if DEBUG
-                        Write.DevWarn($"耗时{VirtualRoot.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(NVIDIAGpuSet)}.{nameof(NvmlInit)}()");
+                        Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {nameof(NvmlHelper)}.{nameof(NvmlInit)}()");
 #endif
                     return _isNvmlInited;
                 }
@@ -75,24 +75,39 @@ namespace NTMiner.Gpus {
                 if (NvmlInit()) {
                     _nvmlDevices.Clear();
                     uint deviceCount = 0;
-                    NvmlNativeMethods.nvmlDeviceGetCount(ref deviceCount);
+                    var r = NvmlNativeMethods.nvmlDeviceGetCount(ref deviceCount);
+                    if (r != nvmlReturn.Success) {
+                        Write.DevWarn($"nvmlDeviceGetCount {r}");
+                    }
                     for (int i = 0; i < deviceCount; i++) {
                         NvGpu gpu = new NvGpu {
                             GpuIndex = i
                         };
                         nvmlDevice nvmlDevice = new nvmlDevice();
                         _nvmlDevices.Add(nvmlDevice);
-                        var nvmlReturn = NvmlNativeMethods.nvmlDeviceGetHandleByIndex((uint)i, ref nvmlDevice);
-                        NvmlNativeMethods.nvmlDeviceGetName(nvmlDevice, out string name);
+                        r = NvmlNativeMethods.nvmlDeviceGetHandleByIndex((uint)i, ref nvmlDevice);
+                        if (r != nvmlReturn.Success) {
+                            Write.DevWarn($"nvmlDeviceGetHandleByIndex({(uint)i}) {r}");
+                        }
+                        r = NvmlNativeMethods.nvmlDeviceGetName(nvmlDevice, out string name);
+                        if (r != nvmlReturn.Success) {
+                            Write.DevWarn($"nvmlDeviceGetName {r}");
+                        }
                         nvmlMemory memory = new nvmlMemory();
-                        NvmlNativeMethods.nvmlDeviceGetMemoryInfo(nvmlDevice, ref memory);
+                        r = NvmlNativeMethods.nvmlDeviceGetMemoryInfo(nvmlDevice, ref memory);
+                        if (r != nvmlReturn.Success) {
+                            Write.DevWarn($"nvmlDeviceGetMemoryInfo {r}");
+                        }
                         // short gpu name
                         if (!string.IsNullOrEmpty(name)) {
                             name = name.Replace("GeForce GTX ", string.Empty);
                             name = name.Replace("GeForce ", string.Empty);
                         }
                         nvmlPciInfo pci = new nvmlPciInfo();
-                        NvmlNativeMethods.nvmlDeviceGetPciInfo(nvmlDevice, ref pci);
+                        r = NvmlNativeMethods.nvmlDeviceGetPciInfo(nvmlDevice, ref pci);
+                        if (r != nvmlReturn.Success) {
+                            Write.DevWarn($"nvmlDeviceGetPciInfo {r}");
+                        }
                         gpu.Name = name;
                         gpu.BusId = (int)pci.bus;
                         gpu.TotalMemory = memory.total;
@@ -121,8 +136,11 @@ namespace NTMiner.Gpus {
             }
             uint power = 0;
             try {
-                NvmlNativeMethods.nvmlDeviceGetPowerUsage(nvmlDevice, ref power);
+                var r = NvmlNativeMethods.nvmlDeviceGetPowerUsage(nvmlDevice, ref power);
                 power = (uint)(power / 1000.0);
+                if (r != nvmlReturn.Success) {
+                    Write.DevWarn($"nvmlDeviceGetPowerUsage {r}");
+                }
             }
             catch {
             }
@@ -135,7 +153,10 @@ namespace NTMiner.Gpus {
             }
             uint temp = 0;
             try {
-                NvmlNativeMethods.nvmlDeviceGetTemperature(nvmlDevice, nvmlTemperatureSensors.Gpu, ref temp);
+                var r = NvmlNativeMethods.nvmlDeviceGetTemperature(nvmlDevice, nvmlTemperatureSensors.Gpu, ref temp);
+                if (r != nvmlReturn.Success) {
+                    Write.DevWarn($"nvmlDeviceGetTemperature {r}");
+                }
             }
             catch {
             }
@@ -148,7 +169,10 @@ namespace NTMiner.Gpus {
             }
             uint fanSpeed = 0;
             try {
-                NvmlNativeMethods.nvmlDeviceGetFanSpeed(nvmlDevice, ref fanSpeed);
+                var r = NvmlNativeMethods.nvmlDeviceGetFanSpeed(nvmlDevice, ref fanSpeed);
+                if (r != nvmlReturn.Success) {
+                    Write.DevWarn($"nvmlDeviceGetFanSpeed {r}");
+                }
             }
             catch {
             }
@@ -162,8 +186,14 @@ namespace NTMiner.Gpus {
                 return;
             }
             try {
-                NvmlNativeMethods.nvmlSystemGetDriverVersion(out driverVersion);
-                NvmlNativeMethods.nvmlSystemGetNVMLVersion(out nvmlVersion);
+                var r = NvmlNativeMethods.nvmlSystemGetDriverVersion(out driverVersion);
+                if (r != nvmlReturn.Success) {
+                    Write.DevWarn($"nvmlSystemGetDriverVersion {r}");
+                }
+                r = NvmlNativeMethods.nvmlSystemGetNVMLVersion(out nvmlVersion);
+                if (r != nvmlReturn.Success) {
+                    Write.DevWarn($"nvmlSystemGetNVMLVersion {r}");
+                }
             }
             catch {
             }

+ 3 - 0
src/NTMinerLogging/Write.cs

@@ -1,7 +1,10 @@
 using System;
+using System.Diagnostics;
 
 namespace NTMiner {
     public static class Write {
+        public static readonly Stopwatch Stopwatch = new Stopwatch();
+
         private static readonly Action<string, ConsoleColor> _consoleUserLineMethod = (line, color) => {
             ConsoleColor oldColor = Console.ForegroundColor;
             Console.ForegroundColor = color;

+ 2 - 4
src/NTMinerlib/VirtualRoot.cs

@@ -9,8 +9,6 @@ using System.Text;
 
 namespace NTMiner {
     public static partial class VirtualRoot {
-        public static readonly Stopwatch Stopwatch = new Stopwatch();
-
         public static readonly string AppFileFullName = Process.GetCurrentProcess().MainModule.FileName;
         public static Guid Id { get; private set; }
 
@@ -85,7 +83,7 @@ namespace NTMiner {
 
         public static Guid GetBrandId(string fileFullName, string keyword) {
 #if DEBUG
-            Stopwatch.Restart();
+            Write.Stopwatch.Restart();
 #endif
             Guid guid = Guid.Empty;
             int LEN = keyword.Length;
@@ -125,7 +123,7 @@ namespace NTMiner {
                 Guid.TryParse(guidString, out guid);
             }
 #if DEBUG
-            Write.DevWarn($"耗时{Stopwatch.ElapsedMilliseconds}毫秒 {typeof(VirtualRoot).Name}.GetBrandId");
+            Write.DevWarn($"耗时{Write.Stopwatch.ElapsedMilliseconds}毫秒 {typeof(VirtualRoot).Name}.GetBrandId");
 #endif
             return guid;
         }