summaryrefslogtreecommitdiffstats
path: root/mainloop.hpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2017-05-22 09:44:50 -0700
committerPatrick Williams <patrick@stwcx.xyz>2017-06-05 23:10:15 +0000
commitab10f164b71eb84e7b378be81523c5e955f8723e (patch)
tree382a4b2d3ddd492044696f86dc098c3cb6c864ad /mainloop.hpp
parent62503a4ee5bfbcf23456cd16682120ee421f102c (diff)
downloadphosphor-hwmon-ab10f164b71eb84e7b378be81523c5e955f8723e.tar.gz
phosphor-hwmon-ab10f164b71eb84e7b378be81523c5e955f8723e.zip
Introduce interval configuration for sensor reads.
This introduces the ability to specify in the sensor label configuration file, a specific sleep interval. The interval is in this file to allow straightforward interval control over the sensors listed in that file. Sensors grouped in the same file are treated as a group and run within the same instance. Tested: I tested setting the interval in one of four running configurations and the change was picked up in that configuration while the others ran at the default interval. Resolves openbmc/phosphor-hwmon#5 Change-Id: Ia9e474bc446090c8ac95dc2e6bf23a4fd6ccf7b7 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'mainloop.hpp')
-rw-r--r--mainloop.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/mainloop.hpp b/mainloop.hpp
index f48e590..d4ef2c4 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -7,6 +7,8 @@
#include "sensorset.hpp"
#include "interface.hpp"
+static constexpr auto default_interval = 1000000;
+
using Object = std::map<InterfaceType, std::experimental::any>;
using ObjectInfo = std::tuple<sdbusplus::bus::bus*, std::string, Object>;
@@ -71,4 +73,6 @@ class MainLoop
const char* _root;
/** @brief DBus object state. */
SensorState state;
+ /** @brief Sleep interval in microseconds. */
+ uint64_t _interval = default_interval;
};
OpenPOWER on IntegriCloud