psusensor: Use configurable read interval

The intervals to read the psusensor value and event were hard-coded to
1000 ms.

For some sensors user may need to use a different interval to poll, e.g.
it should not poll the voltage of RTC battery because it drains the
battery.
The ADC sensor already has the similar change.

Make them configurable parameters from entity-manager's json, so that
the user could use customized poll rate to poll the specific sensors.
If the "PollRate" is not set in the json config, the behavior is the
same as before that uses the default 1s poll rate.

The config parameters are the same as HwmonTemp and ADC sensor.

E.g. the below json config changes the poll rate to 2.0s for pmbus sensor
at i2c 5-0076.

    {
        "Address": "0x76",
        "Bus": 5,
        "Name": "CPU0_VR_0",
        "Labels": [
            "pin",
            "temp1",
            "vout1"
        ],
        "PollRate": 2.0,
        "Thresholds": [...],
        "Type": "pmbus"
    }

Tested: Add `PollRate` in pmbus's sensor and verify the related sensors'
        poll rate is changed accordingly.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I94109e65455dd5c27509ce89a62ef92738714298
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index 077f7ed..d323b4d 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -43,7 +43,7 @@
                      const std::string& sensorConfiguration,
                      const std::string& sensorUnits, unsigned int factor,
                      double max, double min, const std::string& label,
-                     size_t tSize) :
+                     size_t tSize, double pollRate) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(thresholdsIn), sensorConfiguration, objectType, false, max,
            min, conn),
@@ -60,6 +60,10 @@
                   << min << " max " << max << " name \"" << sensorName
                   << "\"\n";
     }
+    if (pollRate > 0.0)
+    {
+        sensorPollMs = static_cast<unsigned int>(pollRate * 1000);
+    }
 
     fd = open(path.c_str(), O_RDONLY | O_NONBLOCK);
     if (fd < 0)