]> git.llucax.com Git - software/eventxx.git/blobdiff - test/bench.cpp
README: Add warning about project being abandoned
[software/eventxx.git] / test / bench.cpp
index a0980129df216ce6af15938940d60ac8d156bcfc..02365596cb1bf526c7d9b145137204cbda9dad8b 100644 (file)
@@ -30,7 +30,7 @@
  *     Added chain event propagation to improve the sensitivity of
  *     the measure respect to the event loop efficency.
  *
- * Wed 2006-12-27 - Modified by Leandro Lucarella <llucarella@integratech.com.ar>
+ * Wed 2006-12-27 - Modified by Leandro Lucarella <llucax+eventxx@gmail.com>
  *
  *     Adapted to test the C++ inteface.
  *
 #include <cerrno>
 #include <vector>
 
-#include <event>
+#include <eventxx>
 
 
 static int count, writes, fired;
 static int *pipes;
-static int num_pipes, num_active, num_writes;
-static std::vector< event::cevent* > events;
-static event::dispatcher d;
+static unsigned num_pipes, num_active, num_writes;
+static std::vector< eventxx::cevent* > events;
+static eventxx::dispatcher d;
 
 
 void
 read_cb(int fd, short which, void *arg)
 {
-       int idx = (int) arg, widx = idx + 1;
+       size_t idx = (size_t) arg, widx = idx + 1;
        u_char ch;
 
        count += read(fd, &ch, sizeof(ch));
@@ -81,19 +81,20 @@ read_cb(int fd, short which, void *arg)
        }
 }
 
-event::time *
+eventxx::time *
 run_once(void)
 {
-       int *cp, i, space;
-       static event::time ts, te;
+       size_t i;
+       int *cp, space;
+       static eventxx::time ts, te;
 
        for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
-               events.push_back(new event::cevent(cp[0], EV_READ | EV_PERSIST,
-                       read_cb, (void *) i));
+               events.push_back(new eventxx::cevent(cp[0],
+                       eventxx::READ | eventxx::PERSIST, read_cb, (void *) i));
                d.add(*events[i]);
        }
 
-       d.dispatch(EVLOOP_ONCE | EVLOOP_NONBLOCK);
+       d.dispatch(eventxx::ONCE | eventxx::NONBLOCK);
 
        fired = 0;
        space = num_pipes / num_active;
@@ -130,9 +131,9 @@ int
 main (int argc, char **argv)
 {
        struct rlimit rl;
-       int i, c;
-       event::time* tv;
-       int *cp;
+       size_t i;
+       eventxx::time* tv;
+       int c, *cp;
        extern char *optarg;
 
        num_pipes = 100;