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

Logging changes

Refers to #36
parent a9d21c4a
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,7 @@ namespace ATxCommon.Monitoring ...@@ -113,7 +113,7 @@ namespace ATxCommon.Monitoring
Log.Debug("Initializing CPU monitoring..."); Log.Debug("Initializing CPU monitoring...");
try { try {
_cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); _cpuCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total");
Log.Debug("CPU monitoring initializing PerformanceCounter (takes 1s)..."); Log.Debug("CPU monitoring initializing PerformanceCounter (takes one second)...");
_cpuCounter.NextValue(); _cpuCounter.NextValue();
Thread.Sleep(1000); Thread.Sleep(1000);
Log.Debug("CPU monitoring current load: {0:0.0}", _cpuCounter.NextValue()); Log.Debug("CPU monitoring current load: {0:0.0}", _cpuCounter.NextValue());
...@@ -144,16 +144,16 @@ namespace ATxCommon.Monitoring ...@@ -144,16 +144,16 @@ namespace ATxCommon.Monitoring
if (_behaving > _probation) { if (_behaving > _probation) {
// this means the load was considered as "low" before, so raise an event: // this means the load was considered as "low" before, so raise an event:
OnLoadAboveLimit(); OnLoadAboveLimit();
Log.Debug("CPU load ({0:0.0}) violating limit ({1})!", _loadReadings[3], _limit); Log.Trace("CPU load ({0:0.0}) violating limit ({1})!", _loadReadings[3], _limit);
} else if (_behaving > 0) { } else if (_behaving > 0) {
// this means we were still in probation, so no need to trigger again... // this means we were still in probation, so no need to trigger again...
Log.Debug("Resetting behaving counter to 0 (was {0}).", _behaving); Log.Trace("Resetting behaving counter to 0 (was {0}).", _behaving);
} }
_behaving = 0; _behaving = 0;
} else { } else {
_behaving++; _behaving++;
if (_behaving == _probation) { if (_behaving == _probation) {
Log.Debug("CPU load below limit for {0} cycles, passing probation!", _probation); Log.Trace("CPU load below limit for {0} cycles, passing probation!", _probation);
OnLoadBelowLimit(); OnLoadBelowLimit();
} else if (_behaving > _probation) { } else if (_behaving > _probation) {
Log.Trace("CPU load behaving well since {0} cycles.", _behaving); Log.Trace("CPU load behaving well since {0} cycles.", _behaving);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment