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

Comparing libev/ev.pod (file contents):
Revision 1.150 by root, Tue May 6 23:34:16 2008 UTC vs.
Revision 1.154 by root, Sun May 11 11:47:27 2008 UTC

64 64
65=head1 DESCRIPTION 65=head1 DESCRIPTION
66 66
67The newest version of this document is also available as an html-formatted 67The newest version of this document is also available as an html-formatted
68web page you might find easier to navigate when reading it for the first 68web page you might find easier to navigate when reading it for the first
69time: L<http://cvs.schmorp.de/libev/ev.html>. 69time: L<http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod>.
70 70
71Libev is an event loop: you register interest in certain events (such as a 71Libev is an event loop: you register interest in certain events (such as a
72file descriptor being readable or a timeout occurring), and it will manage 72file descriptor being readable or a timeout occurring), and it will manage
73these event sources and provide your program with events. 73these event sources and provide your program with events.
74 74
2980defined to be C<0>, then they are not. 2980defined to be C<0>, then they are not.
2981 2981
2982=item EV_MINIMAL 2982=item EV_MINIMAL
2983 2983
2984If you need to shave off some kilobytes of code at the expense of some 2984If you need to shave off some kilobytes of code at the expense of some
2985speed, define this symbol to C<1>. Currently only used for gcc to override 2985speed, define this symbol to C<1>. Currently this is used to override some
2986some inlining decisions, saves roughly 30% codesize of amd64. 2986inlining decisions, saves roughly 30% codesize of amd64. It also selects a
2987much smaller 2-heap for timer management over the default 4-heap.
2987 2988
2988=item EV_PID_HASHSIZE 2989=item EV_PID_HASHSIZE
2989 2990
2990C<ev_child> watchers use a small hash table to distribute workload by 2991C<ev_child> watchers use a small hash table to distribute workload by
2991pid. The default size is C<16> (or C<1> with C<EV_MINIMAL>), usually more 2992pid. The default size is C<16> (or C<1> with C<EV_MINIMAL>), usually more
2997C<ev_stat> watchers use a small hash table to distribute workload by 2998C<ev_stat> watchers use a small hash table to distribute workload by
2998inotify watch id. The default size is C<16> (or C<1> with C<EV_MINIMAL>), 2999inotify watch id. The default size is C<16> (or C<1> with C<EV_MINIMAL>),
2999usually more than enough. If you need to manage thousands of C<ev_stat> 3000usually more than enough. If you need to manage thousands of C<ev_stat>
3000watchers you might want to increase this value (I<must> be a power of 3001watchers you might want to increase this value (I<must> be a power of
3001two). 3002two).
3003
3004=item EV_USE_4HEAP
3005
3006Heaps are not very cache-efficient. To improve the cache-efficiency of the
3007timer and periodics heap, libev uses a 4-heap when this symbol is defined
3008to C<1>. The 4-heap uses more complicated (longer) code but has a
3009noticable after performance with many (thousands) of watchers.
3010
3011The default is C<1> unless C<EV_MINIMAL> is set in which case it is C<0>
3012(disabled).
3013
3014=item EV_HEAP_CACHE_AT
3015
3016Heaps are not very cache-efficient. To improve the cache-efficiency of the
3017timer and periodics heap, libev can cache the timestamp (I<at>) within
3018the heap structure (selected by defining C<EV_HEAP_CACHE_AT> to C<1>),
3019which uses 8-12 bytes more per watcher and a few hundred bytes more code,
3020but avoids random read accesses on heap changes. This noticably improves
3021performance noticably with with many (hundreds) of watchers.
3022
3023The default is C<1> unless C<EV_MINIMAL> is set in which case it is C<0>
3024(disabled).
3002 3025
3003=item EV_COMMON 3026=item EV_COMMON
3004 3027
3005By default, all watchers have a C<void *data> member. By redefining 3028By default, all watchers have a C<void *data> member. By redefining
3006this macro to a something else you can include more and other types of 3029this macro to a something else you can include more and other types of
3176correct watcher to remove. The lists are usually short (you don't usually 3199correct watcher to remove. The lists are usually short (you don't usually
3177have many watchers waiting for the same fd or signal). 3200have many watchers waiting for the same fd or signal).
3178 3201
3179=item Finding the next timer in each loop iteration: O(1) 3202=item Finding the next timer in each loop iteration: O(1)
3180 3203
3181By virtue of using a binary heap, the next timer is always found at the 3204By virtue of using a binary or 4-heap, the next timer is always found at a
3182beginning of the storage array. 3205fixed position in the storage array.
3183 3206
3184=item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd) 3207=item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)
3185 3208
3186A change means an I/O watcher gets started or stopped, which requires 3209A change means an I/O watcher gets started or stopped, which requires
3187libev to recalculate its status (and possibly tell the kernel, depending 3210libev to recalculate its status (and possibly tell the kernel, depending
3319is still at least 31 bits everywhere, which is enough for hundreds of 3342is still at least 31 bits everywhere, which is enough for hundreds of
3320millions of watchers. 3343millions of watchers.
3321 3344
3322=item C<double> must hold a time value in seconds with enough accuracy 3345=item C<double> must hold a time value in seconds with enough accuracy
3323 3346
3324The type C<double> is used to represent timestamps. It is required to have 3347The type C<double> is used to represent timestamps. It is required to
3325at least 51 bits of mantissa, which is good enough for at least into the 3348have at least 51 bits of mantissa (and 9 bits of exponent), which is good
3326year 4000. This requirement is fulfilled by implementations implementing 3349enough for at least into the year 4000. This requirement is fulfilled by
3327IEEE 754 (basically all existing ones). 3350implementations implementing IEEE 754 (basically all existing ones).
3328 3351
3329=back 3352=back
3330 3353
3331If you know of other additional requirements drop me a note. 3354If you know of other additional requirements drop me a note.
3332 3355

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines