Sort wakeups and add send latency.

We don't want to rely on epoll to trigger wakeups in order.  Timers will
likely wake up before watchers due to less kernel delays, etc.  So,
maintain a sorted list of events and see which should be triggered first
and trigger it first.  It also merges wakeups nicely.

This gives us the infrastructure to handle the same problem in
simulation.  We can have perfect timers, and senders with latency.  But,
if a timer wakes up while something is being sent, we will move up the
wakeup and handle it in order.

Change-Id: I8675ec5221dd2603b4aa5b1a3729907a599813b4
diff --git a/aos/controls/control_loop_test.h b/aos/controls/control_loop_test.h
index a0a844f..a2dbb7b 100644
--- a/aos/controls/control_loop_test.h
+++ b/aos/controls/control_loop_test.h
@@ -93,6 +93,10 @@
     return event_loop_factory_.MakeEventLoop(name);
   }
 
+  void set_send_delay(std::chrono::nanoseconds send_delay) {
+    event_loop_factory_.set_send_delay(send_delay);
+  }
+
   void RunFor(monotonic_clock::duration duration) {
     event_loop_factory_.RunFor(duration);
   }