From: "Macario Ortega" <macarui / gmail.com>
>
> I've never used EventMachine and I don't understand much of it but I
> made a timer. First thing I was surprised on how light on the processor
> it is, but no matter how low is the number I pass to add_periodic_timer
> I get jitter of average 50ms and If I create too much timers the jitter
> regulary increases eventually reaching seconds.
> 
> Is there any way to increase timer quatum from Ruby?
> 
> I found this C line somewhere:
>    evma_set_timer_quantum(16/*msec*/);      // roughly 60Hz

Hehe, i thought that looked familiar... it appears to be from an email
I posted on the eventmachine-talk mailing list in 2006.  :)

But yes: these days the set_timer_quantum API is available from ruby.

  EventMachine.set_timer_quantum(10);

Note: Internally, EventMachine places limits on the min/max allowed
values for quantum:  (in em.cpp)

  /* We get a timer-quantum expressed in milliseconds.
   * Don't set a quantum smaller than 5 or larger than 2500.
   */

  if ((interval < 5) || (interval > 2500))
    throw std::runtime_error ("invalid timer-quantum");


Hope this helps,

Bill