ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.244 by root, Mon Jun 29 04:41:34 2009 UTC vs.
Revision 1.245 by root, Tue Jun 30 06:24:38 2009 UTC

811 811
812By setting a higher I<io collect interval> you allow libev to spend more 812By setting a higher I<io collect interval> you allow libev to spend more
813time collecting I/O events, so you can handle more events per iteration, 813time collecting I/O events, so you can handle more events per iteration,
814at the cost of increasing latency. Timeouts (both C<ev_periodic> and 814at the cost of increasing latency. Timeouts (both C<ev_periodic> and
815C<ev_timer>) will be not affected. Setting this to a non-null value will 815C<ev_timer>) will be not affected. Setting this to a non-null value will
816introduce an additional C<ev_sleep ()> call into most loop iterations. 816introduce an additional C<ev_sleep ()> call into most loop iterations. The
817sleep time ensures that libev will not poll for I/O events more often then
818once per this interval, on average.
817 819
818Likewise, by setting a higher I<timeout collect interval> you allow libev 820Likewise, by setting a higher I<timeout collect interval> you allow libev
819to spend more time collecting timeouts, at the expense of increased 821to spend more time collecting timeouts, at the expense of increased
820latency/jitter/inexactness (the watcher callback will be called 822latency/jitter/inexactness (the watcher callback will be called
821later). C<ev_io> watchers will not be affected. Setting this to a non-null 823later). C<ev_io> watchers will not be affected. Setting this to a non-null
823 825
824Many (busy) programs can usually benefit by setting the I/O collect 826Many (busy) programs can usually benefit by setting the I/O collect
825interval to a value near C<0.1> or so, which is often enough for 827interval to a value near C<0.1> or so, which is often enough for
826interactive servers (of course not for games), likewise for timeouts. It 828interactive servers (of course not for games), likewise for timeouts. It
827usually doesn't make much sense to set it to a lower value than C<0.01>, 829usually doesn't make much sense to set it to a lower value than C<0.01>,
828as this approaches the timing granularity of most systems. 830as this approaches the timing granularity of most systems. Note that if
831you do transactions with the outside world and you can't increase the
832parallelity, then this setting will limit your transaction rate (if you
833need to poll once per transaction and the I/O collect interval is 0.01,
834then you can't do more than 100 transations per second).
829 835
830Setting the I<timeout collect interval> can improve the opportunity for 836Setting the I<timeout collect interval> can improve the opportunity for
831saving power, as the program will "bundle" timer callback invocations that 837saving power, as the program will "bundle" timer callback invocations that
832are "near" in time together, by delaying some, thus reducing the number of 838are "near" in time together, by delaying some, thus reducing the number of
833times the process sleeps and wakes up again. Another useful technique to 839times the process sleeps and wakes up again. Another useful technique to
834reduce iterations/wake-ups is to use C<ev_periodic> watchers and make sure 840reduce iterations/wake-ups is to use C<ev_periodic> watchers and make sure
835they fire on, say, one-second boundaries only. 841they fire on, say, one-second boundaries only.
842
843Example: we only need 0.1s timeout granularity, and we wish not to poll
844more often than 100 times per second:
845
846 ev_set_timeout_collect_interval (EV_DEFAULT_UC_ 0.1);
847 ev_set_io_collect_interval (EV_DEFAULT_UC_ 0.01);
836 848
837=item ev_loop_verify (loop) 849=item ev_loop_verify (loop)
838 850
839This function only does something when C<EV_VERIFY> support has been 851This function only does something when C<EV_VERIFY> support has been
840compiled in, which is the default for non-minimal builds. It tries to go 852compiled in, which is the default for non-minimal builds. It tries to go

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines