--- libev/ev.html 2007/12/07 18:09:40 1.65 +++ libev/ev.html 2007/12/07 19:15:39 1.66 @@ -6,7 +6,7 @@ - + @@ -121,6 +121,9 @@

DESCRIPTION

+

The newest version of this document is also available as a html-formatted +web page you might find easier to navigate when reading it for the first +time: http://cvs.schmorp.de/libev/ev.html.

Libev is an event loop: you register interest in certain events (such as a file descriptor being readable or a timeout occuring), and it will manage these event sources and provide your program with events.

@@ -2112,6 +2115,20 @@ for multiple event loops and there is no first event loop pointer argument. Instead, all functions act on the single default loop.

+
EV_MINPRI
+
EV_MAXPRI
+
+

The range of allowed priorities. EV_MINPRI must be smaller or equal to +EV_MAXPRI, but otherwise there are no non-obvious limitations. You can +provide for more priorities by overriding those symbols (usually defined +to be -2 and 2, respectively).

+

When doing priority-based operations, libev usually has to linearly search +all the priorities, so having many of them (hundreds) uses a lot of space +and time, so using the defaults of five priorities (-2 .. +2) is usually +fine.

+

If your embedding app does not need any priorities, defining these both to +0 will save some memory and cpu.

+
EV_PERIODIC_ENABLE

If undefined or defined to be 1, then periodic timers are supported. If @@ -2227,13 +2244,43 @@

Starting and stopping timer/periodic watchers: O(log skipped_other_timers)
+
+

This means that, when you have a watcher that triggers in one hour and +there are 100 watchers that would trigger before that then inserting will +have to skip those 100 watchers.

+
Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers)
+
+

That means that for changing a timer costs less than removing/adding them +as only the relative motion in the event queue has to be paid for.

+
Starting io/check/prepare/idle/signal/child watchers: O(1)
+
+

These just add the watcher into an array or at the head of a list. If +the array needs to be extended libev needs to realloc and move the whole +array, but this happen asymptotically less and less with more watchers, +thus amortised O(1).

+
Stopping check/prepare/idle watchers: O(1)
Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % EV_PID_HASHSIZE))
+
+

These watchers are stored in lists then need to be walked to find the +correct watcher to remove. The lists are usually short (you don't usually +have many watchers waiting for the same fd or signal).

+
Finding the next timer per loop iteration: O(1)
Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)
+
+

A change means an I/O watcher gets started or stopped, which requires +libev to recalculate its status (and possibly tell the kernel).

+
Activating one watcher: O(1)
+
Priority handling: O(number_of_priorities)
+
+

Priorities are implemented by allocating some space for each +priority. When doing priority-based operations, libev usually has to +linearly search all the priorities.

+