~measurement-factory/squid/ecap-1p0

Viewing all changes in revision 12949.

  • Committer: Alex Rousskov
  • Date: 2013-09-12 17:28:21 UTC
  • Revision ID: rousskov@measurement-factory.com-20130912172821-befivxg2ne3ve33r
Use millisecond precision when deciding whether a timed event is ready.

The current code uses "infinite" precision when it comes to deciding whether
the next timed event is ready but uses millisecond (1e-3) precision when
deciding how long to wait before the next event will be ready. This
inconsistency results in the EventSchedule engine telling the main loop that
it has 0 milliseconds to poll pending I/O, but when asked again (after the I/O
is quickly polled), the EventSchedule engine often does not schedule the
promised event and tells the main loop to poll for another 0 milliseconds
again. This cycling may happen many times in a row (until enough time is
wasted for the next event to become ready using higher precision).

The fixed code uses the same (millisecond) precision for both decisions.
After this change, the EventSchedule engine will schedule the next event that
has 0 milliseconds to wait instead of telling the main loop to poll for 0
milliseconds.

After this change, some events will be scheduled and fired a few microseconds
before they are due (instead of a few microseconds after they are due). If
this breaks any existing Squid code, we should adjust EventSchedule to round
up and, hence, fire all events at or after their deadline.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: