Skip to content
Snippets Groups Projects
Commit b759c7ab authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Run both CPU load checking approaches for 10 seconds.

parent 3b9c959d
No related branches found
No related tags found
No related merge requests found
...@@ -35,15 +35,24 @@ namespace ATxDiagnostics ...@@ -35,15 +35,24 @@ namespace ATxDiagnostics
Log.Info("ATxCommon library version: {0}", commonVersionInfo.ProductVersion); Log.Info("ATxCommon library version: {0}", commonVersionInfo.ProductVersion);
Log.Debug("Free space on drive [C:]: " + Conv.BytesToString(SystemChecks.GetFreeDriveSpace("C:"))); Log.Debug("Free space on drive [C:]: " + Conv.BytesToString(SystemChecks.GetFreeDriveSpace("C:")));
Log.Info("Checking CPU load using ATxCommon.Monitoring...");
var cpu = new Cpu { var cpu = new Cpu {
Interval = 250, Interval = 250,
Limit = 25, Limit = 25,
Probation = 16, Probation = 4, // 4 * 250 ms = 1 second
Enabled = true Enabled = true
}; };
while (true) { System.Threading.Thread.Sleep(10000);
cpu.Enabled = false;
Log.Info("Finished checking CPU load using ATxCommon.Monitoring.\n");
Log.Info("Checking CPU load using WMI...");
for (int i = 0; i < 10; i++) {
WmiQueryCpuLoad();
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
} }
Log.Info("Finished checking CPU load using WMI.\n");
} }
private static int WmiQueryCpuLoad() { private static int WmiQueryCpuLoad() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment