// Set smoothing coefficient for loop load average; input is # of milliseconds
// for exp(-1) decay.
-void EventBase::setLoadAvgMsec(uint32_t ms) {
+void EventBase::setLoadAvgMsec(std::chrono::milliseconds ms) {
assert(enableTimeMeasurement_);
std::chrono::microseconds us = std::chrono::milliseconds(ms);
- if (ms > 0) {
+ if (ms > std::chrono::milliseconds::zero()) {
maxLatencyLoopTime_.setTimeInterval(us);
avgLoopTime_.setTimeInterval(us);
} else {
* Set smoothing coefficient for loop load average; # of milliseconds
* for exp(-1) (1/2.71828...) decay.
*/
- void setLoadAvgMsec(uint32_t ms);
+ void setLoadAvgMsec(std::chrono::milliseconds ms);
/**
* reset the load average to a desired value
using std::chrono::microseconds;
using std::chrono::duration_cast;
+using namespace std::chrono_literals;
+
using namespace folly;
///////////////////////////////////////////////////////////////////////////
*/
TEST(EventBaseTest, IdleTime) {
EventBase eventBase;
- eventBase.setLoadAvgMsec(1000);
+ eventBase.setLoadAvgMsec(1000ms);
eventBase.resetLoadAvg(5900.0);
std::deque<uint64_t> timeouts0(4, 8080);
timeouts0.push_front(8000);