idleStart = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now().time_since_epoch()).count();
} else {
- VLOG(11) << "EventBase " << this << " did not timeout "
- " time measurement is disabled "
- " nothingHandledYet(): "<< nothingHandledYet();
+ VLOG(11) << "EventBase " << this << " did not timeout";
}
// If the event loop indicate that there were no more events, and
}
}
-bool EventBase::bumpHandlingTime() {
+void EventBase::bumpHandlingTime() {
+ if (!enableTimeMeasurement_) {
+ return;
+ }
+
VLOG(11) << "EventBase " << this << " " << __PRETTY_FUNCTION__ <<
" (loop) latest " << latestLoopCnt_ << " next " << nextLoopCnt_;
- if(nothingHandledYet()) {
+ if (nothingHandledYet()) {
latestLoopCnt_ = nextLoopCnt_;
- if (enableTimeMeasurement_) {
- // set the time
- startWork_ = std::chrono::duration_cast<std::chrono::microseconds>(
- std::chrono::steady_clock::now().time_since_epoch()).count();
+ // set the time
+ startWork_ = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::steady_clock::now().time_since_epoch())
+ .count();
- VLOG(11) << "EventBase " << this << " " << __PRETTY_FUNCTION__ <<
- " (loop) startWork_ " << startWork_;
- }
- return true;
+ VLOG(11) << "EventBase " << this << " " << __PRETTY_FUNCTION__
+ << " (loop) startWork_ " << startWork_;
}
- return false;
}
void EventBase::terminateLoopSoon() {
value_ += (1.0 - coeff) * busy;
}
-bool EventBase::nothingHandledYet() {
+bool EventBase::nothingHandledYet() const noexcept {
VLOG(11) << "latest " << latestLoopCnt_ << " next " << nextLoopCnt_;
return (nextLoopCnt_ != latestLoopCnt_);
}
* first handler fired within that cycle.
*
*/
- bool bumpHandlingTime() override;
+ void bumpHandlingTime() override final;
class SmoothLoopTime {
public:
void cancelTimeout(AsyncTimeout* obj) override;
- bool isInTimeoutManagerThread() override {
+ bool isInTimeoutManagerThread() override final {
return isInEventBaseThread();
}
* Helper function that tells us whether we have already handled
* some event/timeout/callback in this loop iteration.
*/
- bool nothingHandledYet();
+ bool nothingHandledYet() const noexcept;
// small object used as a callback arg with enough info to execute the
// appropriate client-provided Cob