Commit cd49bf89 authored by Keivaun Waugh's avatar Keivaun Waugh Committed by Facebook GitHub Bot

Call undamped max latency callback on busy time

Summary:
D30916498 (https://github.com/facebook/folly/commit/a2792966998262d7aa2e64b5390b56ddf8ff12f4) added functionality to call a max latency callback using the undamped loop time (instead of the exponentially smoothed loop time). However, that diff used the total loop time to decide when to call the callback instead of the busy time. This means that if the event base is idle on an epoll, meaning it is waiting for work to do, then we'll end up calling the max latency callback. This doesn't make a lot of sense since what we really care about is the event base taking longer than expected to do one iteration of work. From my reading of the damped loop time callback, it looks like it's using the busy time, so this brings the undamped version in line with the damped version.

Proxygen is currently the only consumer of the undamped max latency time: https://fburl.com/code/caheer2t, so this shouldn't change anyone else's counters.

NOTE: the busy time doesn't seem to include the time for the [before loop callbacks](https://fburl.com/code/zsntr8lv) which I think is a mistake. I can address this in a following diff if others agree that this is a mistake.

Reviewed By: jalopezsilva

Differential Revision: D31905279

fbshipit-source-id: 928add6243822a66ee7fa9cc0cbd93a0078ea0e9
parent 0e92d3c2
...@@ -421,8 +421,8 @@ bool EventBase::loopBody(int flags, bool ignoreKeepAlive) { ...@@ -421,8 +421,8 @@ bool EventBase::loopBody(int flags, bool ignoreKeepAlive) {
// back off temporarily -- don't keep spamming maxLatencyCob_ // back off temporarily -- don't keep spamming maxLatencyCob_
// if we're only a bit over the limit // if we're only a bit over the limit
maxLatencyLoopTime_.dampen(0.9); maxLatencyLoopTime_.dampen(0.9);
} else if (!dampenMaxLatency_ && loop_time > maxLatency_) { } else if (!dampenMaxLatency_ && busy > maxLatency_) {
// If no damping, we compare the raw loop time // If no damping, we compare the raw busy time
maxLatencyCob_(); maxLatencyCob_();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment