" busy time: " << busy <<
" avgLoopTime: " << avgLoopTime_.get() <<
" maxLatencyLoopTime: " << maxLatencyLoopTime_.get() <<
- " maxLatency_: " << maxLatency_ <<
+ " maxLatency_: " << maxLatency_.count() << "us" <<
" notificationQueueSize: " << getNotificationQueueSize() <<
" nothingHandledYet(): "<< nothingHandledYet();
// see if our average loop time has exceeded our limit
- if ((maxLatency_ > 0) &&
- (maxLatencyLoopTime_.get() > double(maxLatency_))) {
+ if ((maxLatency_ > std::chrono::microseconds::zero()) &&
+ (maxLatencyLoopTime_.get() > double(maxLatency_.count()))) {
maxLatencyCob_();
// back off temporarily -- don't keep spamming maxLatencyCob_
// if we're only a bit over the limit
* called when that latency is exceeded.
* OBS: This functionality depends on time-measurement.
*/
- void setMaxLatency(int64_t maxLatency, Func maxLatencyCob) {
+ void setMaxLatency(std::chrono::microseconds maxLatency, Func maxLatencyCob) {
assert(enableTimeMeasurement_);
maxLatency_ = maxLatency;
maxLatencyCob_ = std::move(maxLatencyCob);
bool loopKeepAliveActive_{false};
// limit for latency in microseconds (0 disables)
- int64_t maxLatency_;
+ std::chrono::microseconds maxLatency_;
// exponentially-smoothed average loop time for latency-limiting
SmoothLoopTime avgLoopTime_;
bool hostOverloaded = false;
int latencyCallbacks = 0;
- eventBase.setMaxLatency(6000, [&]() {
+ eventBase.setMaxLatency(6000us, [&]() {
++latencyCallbacks;
if (latencyCallbacks != 1) {
FAIL() << "Unexpected latency callback";