diff --git a/ATxDiagnostics/ATxDiagnostics.cs b/ATxDiagnostics/ATxDiagnostics.cs index 83c7995af86f08633f7690a6619a06c113b3325a..f3efa1382f6577f96bc20ecffe6bff033ba76c8f 100644 --- a/ATxDiagnostics/ATxDiagnostics.cs +++ b/ATxDiagnostics/ATxDiagnostics.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Management; using ATxCommon; +using ATxCommon.Monitoring; using NLog; using NLog.Config; using NLog.Targets; @@ -28,10 +29,16 @@ namespace ATxDiagnostics logConfig.LoggingRules.Add(logRuleConsole); LogManager.Configuration = logConfig; - GetCpuCounter(); - Log.Debug(SystemChecks.GetCpuUsage()); - Log.Debug(QueryCpuLoad()); Log.Debug("Free space on drive [C:]: " + Conv.BytesToString(SystemChecks.GetFreeDriveSpace("C:"))); + var cpu = new Cpu { + Interval = 250, + Limit = 25, + Probation = 16, + Enabled = true + }; + while (true) { + System.Threading.Thread.Sleep(1000); + } } private static int QueryCpuLoad() { @@ -74,18 +81,5 @@ namespace ATxDiagnostics return usageInt32; } - private static void GetCpuCounter() { - var counter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); - var i = 0; - while (true) { - i++; - //Log.Debug("PerformanceCounter reading {1}: {0}", counter.NextValue(), i); - var watch = Stopwatch.StartNew(); - var reading = counter.NextValue(); - watch.Stop(); - Console.WriteLine("reading {1} (took {2} ms): {0}", reading, i, watch.ElapsedMilliseconds); - System.Threading.Thread.Sleep(250); - } - } } }