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

Use load indicator field from Cpu class

Refers to #36
parent 5ee528c4
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,6 @@ namespace ATxService ...@@ -45,7 +45,6 @@ namespace ATxService
private int _txCurFileProgress; private int _txCurFileProgress;
private int _waitCyclesBeforeNextTx; private int _waitCyclesBeforeNextTx;
private Cpu _cpu; private Cpu _cpu;
private bool _cpuLoadHigh;
private DateTime _lastUserDirCheck = DateTime.MinValue; private DateTime _lastUserDirCheck = DateTime.MinValue;
...@@ -526,7 +525,6 @@ namespace ATxService ...@@ -526,7 +525,6 @@ namespace ATxService
/// </summary> /// </summary>
private void OnLoadBelowLimit(object sender, EventArgs e) { private void OnLoadBelowLimit(object sender, EventArgs e) {
Log.Warn("CPU load is below given limit."); Log.Warn("CPU load is below given limit.");
_cpuLoadHigh = false;
} }
/// <summary> /// <summary>
...@@ -534,7 +532,6 @@ namespace ATxService ...@@ -534,7 +532,6 @@ namespace ATxService
/// </summary> /// </summary>
private void OnLoadAboveLimit(object sender, EventArgs e) { private void OnLoadAboveLimit(object sender, EventArgs e) {
Log.Warn("High CPU load detected!"); Log.Warn("High CPU load detected!");
_cpuLoadHigh = true;
} }
/// <summary> /// <summary>
...@@ -545,7 +542,7 @@ namespace ATxService ...@@ -545,7 +542,7 @@ namespace ATxService
// check all system parameters for valid ranges and remember the reason in a string // check all system parameters for valid ranges and remember the reason in a string
// if one of them is failing (to report in the log why we're suspended) // if one of them is failing (to report in the log why we're suspended)
if (_cpuLoadHigh) if (_cpu.HighLoad)
limitReason = "CPU usage"; limitReason = "CPU usage";
else if (SystemChecks.GetFreeMemory() < _config.MinAvailableMemory) else if (SystemChecks.GetFreeMemory() < _config.MinAvailableMemory)
limitReason = "RAM usage"; limitReason = "RAM usage";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment