diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index fb941a8a1a9aaae1f3a3783a09513ad47f7698c5..bb8a9cf3100d3862094688bba1ad26ac7461baaf 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -8,6 +8,7 @@ using System.IO; using System.Reflection; using System.Timers; using ATxCommon; +using ATxCommon.Monitoring; using ATxCommon.NLog; using ATxCommon.Serializables; using NLog; @@ -46,6 +47,7 @@ namespace ATxService public PerformanceCounter CpuCounter; private float _cpuLoad; private readonly float[] _cpuLoadLastReadings = {0F, 0F, 0F, 0F}; + private Cpu _cpu; private DateTime _lastUserDirCheck = DateTime.MinValue; @@ -409,6 +411,8 @@ namespace ATxService _loadTimer = new Timer(250); _loadTimer.Elapsed += UpdateCpuLoad; _loadTimer.Enabled = true; + + _cpu = new Cpu(); } catch (Exception ex) { Log.Error("Error in OnStart(): {0}", ex.Message); @@ -499,7 +503,7 @@ namespace ATxService // while this method has not finished yet: _mainTimer.Enabled = false; - Log.Debug("Current CPU load: {0}", _cpuLoad); + Log.Debug("CPU load: {0:#} / {1:#} ({2:#.##})", _cpuLoad, _cpu.Load(), _cpuLoad - _cpu.Load()); try { RunMainTasks();