Browse Source

Improve CPU/mem efficiency by avoiding tracking multiple values

By default, LibreHardwareMonitor will track 24 hours worth of values,
this does not bode well for CPU (which needs to manage the in memory
list) as well as memory usage.

This commit improves the efficiency by not tracking existing values (as
this is for the the downstream metric store).
Nick Babcock 1 year ago
parent
commit
bdf9c2d1f9
1 changed files with 2 additions and 0 deletions
  1. 2 0
      OhmGraphite/SensorCollector.cs

+ 2 - 0
OhmGraphite/SensorCollector.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using NLog;
 using NLog;
 using LibreHardwareMonitor.Hardware;
 using LibreHardwareMonitor.Hardware;
 using LibreHardwareMonitor.Hardware.Storage;
 using LibreHardwareMonitor.Hardware.Storage;
+using System;
 
 
 namespace OhmGraphite
 namespace OhmGraphite
 {
 {
@@ -111,6 +112,7 @@ namespace OhmGraphite
 
 
         private void SensorAdded(ISensor sensor)
         private void SensorAdded(ISensor sensor)
         {
         {
+            sensor.ValuesTimeWindow = TimeSpan.Zero;
             var added = _ids.TryAdd(sensor.Identifier, sensor);
             var added = _ids.TryAdd(sensor.Identifier, sensor);
             var msg = added ? "Sensor added: {0} \"{1}\"" : "Sensor previously added: {0} \"{1}\"";
             var msg = added ? "Sensor added: {0} \"{1}\"" : "Sensor previously added: {0} \"{1}\"";
             Logger.Info(msg, sensor.Identifier, SensorName(sensor));
             Logger.Info(msg, sensor.Identifier, SensorName(sensor));