asyncengine 0.0.1.testing
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +0 -0
- data/asyncengine.gemspec +26 -0
- data/ext/asyncengine_ext/asyncengine_ruby.c +82 -0
- data/ext/asyncengine_ext/extconf.rb +47 -0
- data/ext/asyncengine_ext/libuv/AUTHORS +45 -0
- data/ext/asyncengine_ext/libuv/LICENSE +42 -0
- data/ext/asyncengine_ext/libuv/Makefile +119 -0
- data/ext/asyncengine_ext/libuv/README.md +88 -0
- data/ext/asyncengine_ext/libuv/build/gcc_version.py +20 -0
- data/ext/asyncengine_ext/libuv/common.gypi +176 -0
- data/ext/asyncengine_ext/libuv/config-mingw.mk +61 -0
- data/ext/asyncengine_ext/libuv/config-unix.mk +173 -0
- data/ext/asyncengine_ext/libuv/gyp_uv +60 -0
- data/ext/asyncengine_ext/libuv/include/ares.h +591 -0
- data/ext/asyncengine_ext/libuv/include/ares_version.h +24 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/eio.h +403 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ev.h +838 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/ngx-queue.h +106 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/tree.h +768 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-unix.h +256 -0
- data/ext/asyncengine_ext/libuv/include/uv-private/uv-win.h +458 -0
- data/ext/asyncengine_ext/libuv/include/uv.h +1556 -0
- data/ext/asyncengine_ext/libuv/src/ares/AUTHORS +37 -0
- data/ext/asyncengine_ext/libuv/src/ares/CHANGES +1218 -0
- data/ext/asyncengine_ext/libuv/src/ares/CMakeLists.txt +22 -0
- data/ext/asyncengine_ext/libuv/src/ares/NEWS +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/README +60 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.cares +13 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.msvc +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/README.node +21 -0
- data/ext/asyncengine_ext/libuv/src/ares/RELEASE-NOTES +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/TODO +23 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__close_sockets.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__get_hostent.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__read_line.c +71 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares__timeval.c +111 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_cancel.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.c +190 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_data.h +65 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_destroy.c +105 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_dns.h +90 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_name.c +200 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_expand_string.c +75 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_fds.c +63 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_hostent.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_free_string.c +25 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.c +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getenv.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyaddr.c +301 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_gethostbyname.c +523 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getnameinfo.c +427 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.c +122 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getopt.h +53 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_getsock.c +72 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_init.c +1809 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_iphlpapi.h +221 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_ipv6.h +78 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.c +142 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_library_init.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.c +86 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_llist.h +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_mkquery.c +195 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.c +181 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_nowarn.h +55 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_options.c +248 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_a_reply.c +263 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_aaaa_reply.c +259 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_mx_reply.c +170 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ns_reply.c +182 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_ptr_reply.c +217 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_srv_reply.c +179 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_parse_txt_reply.c +201 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.c +11035 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_platform.h +43 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_private.h +355 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_process.c +1295 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_query.c +183 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_rules.h +144 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_search.c +321 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_send.c +134 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_setup.h +199 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.c +66 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strcasecmp.h +30 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.c +42 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strdup.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_strerror.c +56 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_timeout.c +80 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_version.c +11 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.c +79 -0
- data/ext/asyncengine_ext/libuv/src/ares/ares_writev.h +36 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.c +59 -0
- data/ext/asyncengine_ext/libuv/src/ares/bitncmp.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_cygwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_darwin/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_freebsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_linux/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_netbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_openbsd/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_sunos/ares_config.h +512 -0
- data/ext/asyncengine_ext/libuv/src/ares/config_win32/ares_config.h +369 -0
- data/ext/asyncengine_ext/libuv/src/ares/get_ver.awk +35 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.c +451 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_net_pton.h +31 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.c +208 -0
- data/ext/asyncengine_ext/libuv/src/ares/inet_ntop.h +26 -0
- data/ext/asyncengine_ext/libuv/src/ares/nameser.h +203 -0
- data/ext/asyncengine_ext/libuv/src/ares/setup_once.h +504 -0
- data/ext/asyncengine_ext/libuv/src/ares/windows_port.c +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/async.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/cares.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/check.c +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/core.c +588 -0
- data/ext/asyncengine_ext/libuv/src/unix/cygwin.c +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/darwin.c +341 -0
- data/ext/asyncengine_ext/libuv/src/unix/dl.c +91 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Changes +63 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/Makefile.am +15 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/autogen.sh +3 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config.h.in +86 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_cygwin.h +80 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_darwin.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_freebsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_linux.h +94 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_netbsd.h +81 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_openbsd.h +137 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/config_sunos.h +84 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/configure.ac +22 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/demo.c +194 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/ecb.h +370 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.3 +3428 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.c +2593 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/eio.pod +969 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/libeio.m4 +195 -0
- data/ext/asyncengine_ext/libuv/src/unix/eio/xthread.h +164 -0
- data/ext/asyncengine_ext/libuv/src/unix/error.c +98 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Changes +388 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/LICENSE +36 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.am +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/Makefile.in +771 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/README +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/aclocal.m4 +8957 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/autogen.sh +6 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.guess +1526 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.h.in +125 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config.sub +1658 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_cygwin.h +123 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_darwin.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_freebsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_linux.h +141 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_netbsd.h +120 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_openbsd.h +126 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/config_sunos.h +122 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure +13037 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/configure.ac +18 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/depcomp +630 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev++.h +816 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.3 +5311 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.c +3921 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev.pod +5243 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_epoll.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_kqueue.c +235 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_poll.c +148 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_port.c +179 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_select.c +310 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_vars.h +203 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_win32.c +153 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ev_wrap.h +196 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.c +402 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/event.h +170 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/install-sh +294 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/libev.m4 +39 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/ltmain.sh +8413 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/missing +336 -0
- data/ext/asyncengine_ext/libuv/src/unix/ev/mkinstalldirs +111 -0
- data/ext/asyncengine_ext/libuv/src/unix/freebsd.c +312 -0
- data/ext/asyncengine_ext/libuv/src/unix/fs.c +707 -0
- data/ext/asyncengine_ext/libuv/src/unix/idle.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/internal.h +161 -0
- data/ext/asyncengine_ext/libuv/src/unix/kqueue.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/core.c +474 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/inotify.c +211 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.c +230 -0
- data/ext/asyncengine_ext/libuv/src/unix/linux/syscalls.h +87 -0
- data/ext/asyncengine_ext/libuv/src/unix/loop.c +58 -0
- data/ext/asyncengine_ext/libuv/src/unix/netbsd.c +108 -0
- data/ext/asyncengine_ext/libuv/src/unix/openbsd.c +295 -0
- data/ext/asyncengine_ext/libuv/src/unix/pipe.c +266 -0
- data/ext/asyncengine_ext/libuv/src/unix/prepare.c +79 -0
- data/ext/asyncengine_ext/libuv/src/unix/process.c +369 -0
- data/ext/asyncengine_ext/libuv/src/unix/stream.c +1033 -0
- data/ext/asyncengine_ext/libuv/src/unix/sunos.c +466 -0
- data/ext/asyncengine_ext/libuv/src/unix/tcp.c +327 -0
- data/ext/asyncengine_ext/libuv/src/unix/thread.c +154 -0
- data/ext/asyncengine_ext/libuv/src/unix/timer.c +127 -0
- data/ext/asyncengine_ext/libuv/src/unix/tty.c +146 -0
- data/ext/asyncengine_ext/libuv/src/unix/udp.c +670 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.c +124 -0
- data/ext/asyncengine_ext/libuv/src/unix/uv-eio.h +13 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.c +354 -0
- data/ext/asyncengine_ext/libuv/src/uv-common.h +87 -0
- data/ext/asyncengine_ext/libuv/src/win/async.c +127 -0
- data/ext/asyncengine_ext/libuv/src/win/cares.c +290 -0
- data/ext/asyncengine_ext/libuv/src/win/core.c +270 -0
- data/ext/asyncengine_ext/libuv/src/win/dl.c +82 -0
- data/ext/asyncengine_ext/libuv/src/win/error.c +132 -0
- data/ext/asyncengine_ext/libuv/src/win/fs-event.c +514 -0
- data/ext/asyncengine_ext/libuv/src/win/fs.c +1576 -0
- data/ext/asyncengine_ext/libuv/src/win/getaddrinfo.c +372 -0
- data/ext/asyncengine_ext/libuv/src/win/handle.c +225 -0
- data/ext/asyncengine_ext/libuv/src/win/internal.h +352 -0
- data/ext/asyncengine_ext/libuv/src/win/loop-watcher.c +131 -0
- data/ext/asyncengine_ext/libuv/src/win/pipe.c +1661 -0
- data/ext/asyncengine_ext/libuv/src/win/process.c +1140 -0
- data/ext/asyncengine_ext/libuv/src/win/req.c +174 -0
- data/ext/asyncengine_ext/libuv/src/win/stream.c +201 -0
- data/ext/asyncengine_ext/libuv/src/win/tcp.c +1282 -0
- data/ext/asyncengine_ext/libuv/src/win/thread.c +332 -0
- data/ext/asyncengine_ext/libuv/src/win/threadpool.c +73 -0
- data/ext/asyncengine_ext/libuv/src/win/timer.c +276 -0
- data/ext/asyncengine_ext/libuv/src/win/tty.c +1795 -0
- data/ext/asyncengine_ext/libuv/src/win/udp.c +709 -0
- data/ext/asyncengine_ext/libuv/src/win/util.c +719 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.c +117 -0
- data/ext/asyncengine_ext/libuv/src/win/winapi.h +4419 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.c +470 -0
- data/ext/asyncengine_ext/libuv/src/win/winsock.h +138 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ares.c +118 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-getaddrinfo.c +94 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-list.h +105 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-ping-pongs.c +213 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pound.c +324 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-pump.c +462 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-sizes.c +40 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-spawn.c +156 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-tcp-write-batch.c +140 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/asyncengine_ext/libuv/test/benchmark-udp-packet-storm.c +247 -0
- data/ext/asyncengine_ext/libuv/test/blackhole-server.c +118 -0
- data/ext/asyncengine_ext/libuv/test/dns-server.c +321 -0
- data/ext/asyncengine_ext/libuv/test/echo-server.c +370 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/asyncengine_ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/asyncengine_ext/libuv/test/run-benchmarks.c +64 -0
- data/ext/asyncengine_ext/libuv/test/run-tests.c +108 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.c +315 -0
- data/ext/asyncengine_ext/libuv/test/runner-unix.h +36 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.c +343 -0
- data/ext/asyncengine_ext/libuv/test/runner-win.h +42 -0
- data/ext/asyncengine_ext/libuv/test/runner.c +317 -0
- data/ext/asyncengine_ext/libuv/test/runner.h +159 -0
- data/ext/asyncengine_ext/libuv/test/task.h +117 -0
- data/ext/asyncengine_ext/libuv/test/test-async.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-callback-stack.c +203 -0
- data/ext/asyncengine_ext/libuv/test/test-connection-fail.c +148 -0
- data/ext/asyncengine_ext/libuv/test/test-counters-init.c +216 -0
- data/ext/asyncengine_ext/libuv/test/test-cwd-and-chdir.c +64 -0
- data/ext/asyncengine_ext/libuv/test/test-delayed-accept.c +197 -0
- data/ext/asyncengine_ext/libuv/test/test-dlerror.c +49 -0
- data/ext/asyncengine_ext/libuv/test/test-eio-overflow.c +90 -0
- data/ext/asyncengine_ext/libuv/test/test-error.c +59 -0
- data/ext/asyncengine_ext/libuv/test/test-fail-always.c +29 -0
- data/ext/asyncengine_ext/libuv/test/test-fs-event.c +442 -0
- data/ext/asyncengine_ext/libuv/test/test-fs.c +1731 -0
- data/ext/asyncengine_ext/libuv/test/test-get-currentexe.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-get-loadavg.c +36 -0
- data/ext/asyncengine_ext/libuv/test/test-get-memory.c +38 -0
- data/ext/asyncengine_ext/libuv/test/test-getaddrinfo.c +122 -0
- data/ext/asyncengine_ext/libuv/test/test-gethostbyname.c +189 -0
- data/ext/asyncengine_ext/libuv/test/test-getsockname.c +342 -0
- data/ext/asyncengine_ext/libuv/test/test-hrtime.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-idle.c +81 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc-send-recv.c +209 -0
- data/ext/asyncengine_ext/libuv/test/test-ipc.c +614 -0
- data/ext/asyncengine_ext/libuv/test/test-list.h +371 -0
- data/ext/asyncengine_ext/libuv/test/test-loop-handles.c +359 -0
- data/ext/asyncengine_ext/libuv/test/test-multiple-listen.c +102 -0
- data/ext/asyncengine_ext/libuv/test/test-mutexes.c +63 -0
- data/ext/asyncengine_ext/libuv/test/test-pass-always.c +28 -0
- data/ext/asyncengine_ext/libuv/test/test-ping-pong.c +253 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-bind-error.c +140 -0
- data/ext/asyncengine_ext/libuv/test/test-pipe-connect-error.c +96 -0
- data/ext/asyncengine_ext/libuv/test/test-platform-output.c +87 -0
- data/ext/asyncengine_ext/libuv/test/test-process-title.c +42 -0
- data/ext/asyncengine_ext/libuv/test/test-ref.c +322 -0
- data/ext/asyncengine_ext/libuv/test/test-run-once.c +44 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-close.c +103 -0
- data/ext/asyncengine_ext/libuv/test/test-shutdown-eof.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-spawn.c +499 -0
- data/ext/asyncengine_ext/libuv/test/test-stdio-over-pipes.c +256 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind-error.c +191 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-bind6-error.c +154 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-close.c +129 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect-error.c +70 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-connect6-error.c +68 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-flags.c +51 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-error.c +168 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-write-to-half-open-connection.c +135 -0
- data/ext/asyncengine_ext/libuv/test/test-tcp-writealot.c +195 -0
- data/ext/asyncengine_ext/libuv/test/test-thread.c +183 -0
- data/ext/asyncengine_ext/libuv/test/test-threadpool.c +57 -0
- data/ext/asyncengine_ext/libuv/test/test-timer-again.c +141 -0
- data/ext/asyncengine_ext/libuv/test/test-timer.c +130 -0
- data/ext/asyncengine_ext/libuv/test/test-tty.c +110 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-dgram-too-big.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-ipv6.c +156 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-join.c +139 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-multicast-ttl.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-options.c +86 -0
- data/ext/asyncengine_ext/libuv/test/test-udp-send-and-recv.c +208 -0
- data/ext/asyncengine_ext/libuv/test/test-util.c +97 -0
- data/ext/asyncengine_ext/libuv/uv.gyp +435 -0
- data/ext/asyncengine_ext/libuv/vcbuild.bat +105 -0
- data/lib/asyncengine/version.rb +3 -0
- data/lib/asyncengine.rb +41 -0
- metadata +384 -0
@@ -0,0 +1,462 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "task.h"
|
23
|
+
#include "uv.h"
|
24
|
+
|
25
|
+
#include <math.h>
|
26
|
+
#include <stdio.h>
|
27
|
+
|
28
|
+
|
29
|
+
static int TARGET_CONNECTIONS;
|
30
|
+
#define WRITE_BUFFER_SIZE 8192
|
31
|
+
#define MAX_SIMULTANEOUS_CONNECTS 100
|
32
|
+
|
33
|
+
#define PRINT_STATS 0
|
34
|
+
#define STATS_INTERVAL 1000 /* msec */
|
35
|
+
#define STATS_COUNT 5
|
36
|
+
|
37
|
+
|
38
|
+
static void do_write(uv_stream_t*);
|
39
|
+
static void maybe_connect_some();
|
40
|
+
|
41
|
+
static uv_req_t* req_alloc();
|
42
|
+
static void req_free(uv_req_t* uv_req);
|
43
|
+
|
44
|
+
static uv_buf_t buf_alloc(uv_handle_t*, size_t size);
|
45
|
+
static void buf_free(uv_buf_t uv_buf_t);
|
46
|
+
|
47
|
+
static uv_loop_t* loop;
|
48
|
+
|
49
|
+
static uv_tcp_t tcpServer;
|
50
|
+
static uv_pipe_t pipeServer;
|
51
|
+
static uv_stream_t* server;
|
52
|
+
static struct sockaddr_in listen_addr;
|
53
|
+
static struct sockaddr_in connect_addr;
|
54
|
+
|
55
|
+
static int64_t start_time;
|
56
|
+
|
57
|
+
static int max_connect_socket = 0;
|
58
|
+
static int max_read_sockets = 0;
|
59
|
+
static int read_sockets = 0;
|
60
|
+
static int write_sockets = 0;
|
61
|
+
|
62
|
+
static int64_t nrecv = 0;
|
63
|
+
static int64_t nrecv_total = 0;
|
64
|
+
static int64_t nsent = 0;
|
65
|
+
static int64_t nsent_total = 0;
|
66
|
+
|
67
|
+
static int stats_left = 0;
|
68
|
+
|
69
|
+
static char write_buffer[WRITE_BUFFER_SIZE];
|
70
|
+
|
71
|
+
/* Make this as large as you need. */
|
72
|
+
#define MAX_WRITE_HANDLES 1000
|
73
|
+
|
74
|
+
static stream_type type;
|
75
|
+
|
76
|
+
static uv_tcp_t tcp_write_handles[MAX_WRITE_HANDLES];
|
77
|
+
static uv_pipe_t pipe_write_handles[MAX_WRITE_HANDLES];
|
78
|
+
|
79
|
+
static uv_timer_t timer_handle;
|
80
|
+
|
81
|
+
|
82
|
+
static double gbit(int64_t bytes, int64_t passed_ms) {
|
83
|
+
double gbits = ((double)bytes / (1024 * 1024 * 1024)) * 8;
|
84
|
+
return gbits / ((double)passed_ms / 1000);
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
static void show_stats(uv_timer_t* handle, int status) {
|
89
|
+
int64_t diff;
|
90
|
+
int i;
|
91
|
+
|
92
|
+
#if PRINT_STATS
|
93
|
+
LOGF("connections: %d, write: %.1f gbit/s\n",
|
94
|
+
write_sockets,
|
95
|
+
gbit(nsent, STATS_INTERVAL));
|
96
|
+
#endif
|
97
|
+
|
98
|
+
/* Exit if the show is over */
|
99
|
+
if (!--stats_left) {
|
100
|
+
|
101
|
+
uv_update_time(loop);
|
102
|
+
diff = uv_now(loop) - start_time;
|
103
|
+
|
104
|
+
LOGF("%s_pump%d_client: %.1f gbit/s\n", type == TCP ? "tcp" : "pipe", write_sockets,
|
105
|
+
gbit(nsent_total, diff));
|
106
|
+
|
107
|
+
for (i = 0; i < write_sockets; i++) {
|
108
|
+
uv_close(type == TCP ? (uv_handle_t*)&tcp_write_handles[i] : (uv_handle_t*)&pipe_write_handles[i], NULL);
|
109
|
+
}
|
110
|
+
|
111
|
+
exit(0);
|
112
|
+
}
|
113
|
+
|
114
|
+
/* Reset read and write counters */
|
115
|
+
nrecv = 0;
|
116
|
+
nsent = 0;
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
static void read_show_stats() {
|
121
|
+
int64_t diff;
|
122
|
+
|
123
|
+
uv_update_time(loop);
|
124
|
+
diff = uv_now(loop) - start_time;
|
125
|
+
|
126
|
+
LOGF("%s_pump%d_server: %.1f gbit/s\n", type == TCP ? "tcp" : "pipe", max_read_sockets,
|
127
|
+
gbit(nrecv_total, diff));
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
void write_sockets_close_cb(uv_handle_t* handle) {
|
133
|
+
/* If any client closes, the process is done. */
|
134
|
+
exit(0);
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
void read_sockets_close_cb(uv_handle_t* handle) {
|
139
|
+
free(handle);
|
140
|
+
read_sockets--;
|
141
|
+
|
142
|
+
/* If it's past the first second and everyone has closed their connection
|
143
|
+
* Then print stats.
|
144
|
+
*/
|
145
|
+
if (uv_now(loop) - start_time > 1000 && read_sockets == 0) {
|
146
|
+
read_show_stats();
|
147
|
+
uv_close((uv_handle_t*)server, NULL);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
|
152
|
+
static void start_stats_collection() {
|
153
|
+
int r;
|
154
|
+
|
155
|
+
/* Show-stats timer */
|
156
|
+
stats_left = STATS_COUNT;
|
157
|
+
r = uv_timer_init(loop, &timer_handle);
|
158
|
+
ASSERT(r == 0);
|
159
|
+
r = uv_timer_start(&timer_handle, show_stats, STATS_INTERVAL, STATS_INTERVAL);
|
160
|
+
ASSERT(r == 0);
|
161
|
+
|
162
|
+
uv_update_time(loop);
|
163
|
+
start_time = uv_now(loop);
|
164
|
+
}
|
165
|
+
|
166
|
+
|
167
|
+
static void read_cb(uv_stream_t* stream, ssize_t bytes, uv_buf_t buf) {
|
168
|
+
if (nrecv_total == 0) {
|
169
|
+
ASSERT(start_time == 0);
|
170
|
+
uv_update_time(loop);
|
171
|
+
start_time = uv_now(loop);
|
172
|
+
}
|
173
|
+
|
174
|
+
if (bytes < 0) {
|
175
|
+
uv_close((uv_handle_t*)stream, read_sockets_close_cb);
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
|
179
|
+
buf_free(buf);
|
180
|
+
|
181
|
+
nrecv += bytes;
|
182
|
+
nrecv_total += bytes;
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
static void write_cb(uv_write_t* req, int status) {
|
187
|
+
ASSERT(status == 0);
|
188
|
+
|
189
|
+
req_free((uv_req_t*) req);
|
190
|
+
|
191
|
+
nsent += sizeof write_buffer;
|
192
|
+
nsent_total += sizeof write_buffer;
|
193
|
+
|
194
|
+
do_write((uv_stream_t*) req->handle);
|
195
|
+
}
|
196
|
+
|
197
|
+
|
198
|
+
static void do_write(uv_stream_t* stream) {
|
199
|
+
uv_write_t* req;
|
200
|
+
uv_buf_t buf;
|
201
|
+
int r;
|
202
|
+
|
203
|
+
buf.base = (char*) &write_buffer;
|
204
|
+
buf.len = sizeof write_buffer;
|
205
|
+
|
206
|
+
while (stream->write_queue_size == 0) {
|
207
|
+
req = (uv_write_t*) req_alloc();
|
208
|
+
r = uv_write(req, stream, &buf, 1, write_cb);
|
209
|
+
ASSERT(r == 0);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
static void connect_cb(uv_connect_t* req, int status) {
|
215
|
+
int i;
|
216
|
+
|
217
|
+
if (status) LOG(uv_strerror(uv_last_error(loop)));
|
218
|
+
ASSERT(status == 0);
|
219
|
+
|
220
|
+
write_sockets++;
|
221
|
+
req_free((uv_req_t*) req);
|
222
|
+
|
223
|
+
maybe_connect_some();
|
224
|
+
|
225
|
+
if (write_sockets == TARGET_CONNECTIONS) {
|
226
|
+
start_stats_collection();
|
227
|
+
|
228
|
+
/* Yay! start writing */
|
229
|
+
for (i = 0; i < write_sockets; i++) {
|
230
|
+
do_write(type == TCP ? (uv_stream_t*)&tcp_write_handles[i] : (uv_stream_t*)&pipe_write_handles[i]);
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
static void maybe_connect_some() {
|
237
|
+
uv_connect_t* req;
|
238
|
+
uv_tcp_t* tcp;
|
239
|
+
uv_pipe_t* pipe;
|
240
|
+
int r;
|
241
|
+
|
242
|
+
while (max_connect_socket < TARGET_CONNECTIONS &&
|
243
|
+
max_connect_socket < write_sockets + MAX_SIMULTANEOUS_CONNECTS) {
|
244
|
+
if (type == TCP) {
|
245
|
+
tcp = &tcp_write_handles[max_connect_socket++];
|
246
|
+
|
247
|
+
r = uv_tcp_init(loop, tcp);
|
248
|
+
ASSERT(r == 0);
|
249
|
+
|
250
|
+
req = (uv_connect_t*) req_alloc();
|
251
|
+
r = uv_tcp_connect(req, tcp, connect_addr, connect_cb);
|
252
|
+
ASSERT(r == 0);
|
253
|
+
} else {
|
254
|
+
pipe = &pipe_write_handles[max_connect_socket++];
|
255
|
+
|
256
|
+
r = uv_pipe_init(loop, pipe, 0);
|
257
|
+
ASSERT(r == 0);
|
258
|
+
|
259
|
+
req = (uv_connect_t*) req_alloc();
|
260
|
+
uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
|
266
|
+
static void connection_cb(uv_stream_t* s, int status) {
|
267
|
+
uv_stream_t* stream;
|
268
|
+
int r;
|
269
|
+
|
270
|
+
ASSERT(server == s);
|
271
|
+
ASSERT(status == 0);
|
272
|
+
|
273
|
+
if (type == TCP) {
|
274
|
+
stream = (uv_stream_t*)malloc(sizeof(uv_tcp_t));
|
275
|
+
r = uv_tcp_init(loop, (uv_tcp_t*)stream);
|
276
|
+
ASSERT(r == 0);
|
277
|
+
} else {
|
278
|
+
stream = (uv_stream_t*)malloc(sizeof(uv_pipe_t));
|
279
|
+
r = uv_pipe_init(loop, (uv_pipe_t*)stream, 0);
|
280
|
+
ASSERT(r == 0);
|
281
|
+
}
|
282
|
+
|
283
|
+
r = uv_accept(s, stream);
|
284
|
+
ASSERT(r == 0);
|
285
|
+
|
286
|
+
r = uv_read_start(stream, buf_alloc, read_cb);
|
287
|
+
ASSERT(r == 0);
|
288
|
+
|
289
|
+
read_sockets++;
|
290
|
+
max_read_sockets++;
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
/*
|
295
|
+
* Request allocator
|
296
|
+
*/
|
297
|
+
|
298
|
+
typedef struct req_list_s {
|
299
|
+
union uv_any_req uv_req;
|
300
|
+
struct req_list_s* next;
|
301
|
+
} req_list_t;
|
302
|
+
|
303
|
+
|
304
|
+
static req_list_t* req_freelist = NULL;
|
305
|
+
|
306
|
+
|
307
|
+
static uv_req_t* req_alloc() {
|
308
|
+
req_list_t* req;
|
309
|
+
|
310
|
+
req = req_freelist;
|
311
|
+
if (req != NULL) {
|
312
|
+
req_freelist = req->next;
|
313
|
+
return (uv_req_t*) req;
|
314
|
+
}
|
315
|
+
|
316
|
+
req = (req_list_t*) malloc(sizeof *req);
|
317
|
+
return (uv_req_t*) req;
|
318
|
+
}
|
319
|
+
|
320
|
+
|
321
|
+
static void req_free(uv_req_t* uv_req) {
|
322
|
+
req_list_t* req = (req_list_t*) uv_req;
|
323
|
+
|
324
|
+
req->next = req_freelist;
|
325
|
+
req_freelist = req;
|
326
|
+
}
|
327
|
+
|
328
|
+
|
329
|
+
/*
|
330
|
+
* Buffer allocator
|
331
|
+
*/
|
332
|
+
|
333
|
+
typedef struct buf_list_s {
|
334
|
+
uv_buf_t uv_buf_t;
|
335
|
+
struct buf_list_s* next;
|
336
|
+
} buf_list_t;
|
337
|
+
|
338
|
+
|
339
|
+
static buf_list_t* buf_freelist = NULL;
|
340
|
+
|
341
|
+
|
342
|
+
static uv_buf_t buf_alloc(uv_handle_t* handle, size_t size) {
|
343
|
+
buf_list_t* buf;
|
344
|
+
|
345
|
+
buf = buf_freelist;
|
346
|
+
if (buf != NULL) {
|
347
|
+
buf_freelist = buf->next;
|
348
|
+
return buf->uv_buf_t;
|
349
|
+
}
|
350
|
+
|
351
|
+
buf = (buf_list_t*) malloc(size + sizeof *buf);
|
352
|
+
buf->uv_buf_t.len = (unsigned int)size;
|
353
|
+
buf->uv_buf_t.base = ((char*) buf) + sizeof *buf;
|
354
|
+
|
355
|
+
return buf->uv_buf_t;
|
356
|
+
}
|
357
|
+
|
358
|
+
|
359
|
+
static void buf_free(uv_buf_t uv_buf_t) {
|
360
|
+
buf_list_t* buf = (buf_list_t*) (uv_buf_t.base - sizeof *buf);
|
361
|
+
|
362
|
+
buf->next = buf_freelist;
|
363
|
+
buf_freelist = buf;
|
364
|
+
}
|
365
|
+
|
366
|
+
|
367
|
+
HELPER_IMPL(tcp_pump_server) {
|
368
|
+
int r;
|
369
|
+
|
370
|
+
type = TCP;
|
371
|
+
loop = uv_default_loop();
|
372
|
+
|
373
|
+
listen_addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
|
374
|
+
|
375
|
+
/* Server */
|
376
|
+
server = (uv_stream_t*)&tcpServer;
|
377
|
+
r = uv_tcp_init(loop, &tcpServer);
|
378
|
+
ASSERT(r == 0);
|
379
|
+
r = uv_tcp_bind(&tcpServer, listen_addr);
|
380
|
+
ASSERT(r == 0);
|
381
|
+
r = uv_listen((uv_stream_t*)&tcpServer, MAX_WRITE_HANDLES, connection_cb);
|
382
|
+
ASSERT(r == 0);
|
383
|
+
|
384
|
+
uv_run(loop);
|
385
|
+
|
386
|
+
return 0;
|
387
|
+
}
|
388
|
+
|
389
|
+
|
390
|
+
HELPER_IMPL(pipe_pump_server) {
|
391
|
+
int r;
|
392
|
+
type = PIPE;
|
393
|
+
|
394
|
+
loop = uv_default_loop();
|
395
|
+
|
396
|
+
/* Server */
|
397
|
+
server = (uv_stream_t*)&pipeServer;
|
398
|
+
r = uv_pipe_init(loop, &pipeServer, 0);
|
399
|
+
ASSERT(r == 0);
|
400
|
+
r = uv_pipe_bind(&pipeServer, TEST_PIPENAME);
|
401
|
+
ASSERT(r == 0);
|
402
|
+
r = uv_listen((uv_stream_t*)&pipeServer, MAX_WRITE_HANDLES, connection_cb);
|
403
|
+
ASSERT(r == 0);
|
404
|
+
|
405
|
+
uv_run(loop);
|
406
|
+
|
407
|
+
return 0;
|
408
|
+
}
|
409
|
+
|
410
|
+
|
411
|
+
void tcp_pump(int n) {
|
412
|
+
ASSERT(n <= MAX_WRITE_HANDLES);
|
413
|
+
TARGET_CONNECTIONS = n;
|
414
|
+
type = TCP;
|
415
|
+
|
416
|
+
loop = uv_default_loop();
|
417
|
+
|
418
|
+
connect_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
|
419
|
+
|
420
|
+
/* Start making connections */
|
421
|
+
maybe_connect_some();
|
422
|
+
|
423
|
+
uv_run(loop);
|
424
|
+
}
|
425
|
+
|
426
|
+
|
427
|
+
void pipe_pump(int n) {
|
428
|
+
ASSERT(n <= MAX_WRITE_HANDLES);
|
429
|
+
TARGET_CONNECTIONS = n;
|
430
|
+
type = PIPE;
|
431
|
+
|
432
|
+
loop = uv_default_loop();
|
433
|
+
|
434
|
+
/* Start making connections */
|
435
|
+
maybe_connect_some();
|
436
|
+
|
437
|
+
uv_run(loop);
|
438
|
+
}
|
439
|
+
|
440
|
+
|
441
|
+
BENCHMARK_IMPL(tcp_pump100_client) {
|
442
|
+
tcp_pump(100);
|
443
|
+
return 0;
|
444
|
+
}
|
445
|
+
|
446
|
+
|
447
|
+
BENCHMARK_IMPL(tcp_pump1_client) {
|
448
|
+
tcp_pump(1);
|
449
|
+
return 0;
|
450
|
+
}
|
451
|
+
|
452
|
+
|
453
|
+
BENCHMARK_IMPL(pipe_pump100_client) {
|
454
|
+
pipe_pump(100);
|
455
|
+
return 0;
|
456
|
+
}
|
457
|
+
|
458
|
+
|
459
|
+
BENCHMARK_IMPL(pipe_pump1_client) {
|
460
|
+
pipe_pump(1);
|
461
|
+
return 0;
|
462
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "task.h"
|
23
|
+
#include "uv.h"
|
24
|
+
|
25
|
+
|
26
|
+
BENCHMARK_IMPL(sizes) {
|
27
|
+
LOGF("uv_shutdown_t: %u bytes\n", (unsigned int) sizeof(uv_shutdown_t));
|
28
|
+
LOGF("uv_write_t: %u bytes\n", (unsigned int) sizeof(uv_write_t));
|
29
|
+
LOGF("uv_connect_t: %u bytes\n", (unsigned int) sizeof(uv_connect_t));
|
30
|
+
LOGF("uv_tcp_t: %u bytes\n", (unsigned int) sizeof(uv_tcp_t));
|
31
|
+
LOGF("uv_pipe_t: %u bytes\n", (unsigned int) sizeof(uv_pipe_t));
|
32
|
+
LOGF("uv_tty_t: %u bytes\n", (unsigned int) sizeof(uv_tty_t));
|
33
|
+
LOGF("uv_prepare_t: %u bytes\n", (unsigned int) sizeof(uv_prepare_t));
|
34
|
+
LOGF("uv_check_t: %u bytes\n", (unsigned int) sizeof(uv_check_t));
|
35
|
+
LOGF("uv_idle_t: %u bytes\n", (unsigned int) sizeof(uv_idle_t));
|
36
|
+
LOGF("uv_async_t: %u bytes\n", (unsigned int) sizeof(uv_async_t));
|
37
|
+
LOGF("uv_timer_t: %u bytes\n", (unsigned int) sizeof(uv_timer_t));
|
38
|
+
LOGF("uv_process_t: %u bytes\n", (unsigned int) sizeof(uv_process_t));
|
39
|
+
return 0;
|
40
|
+
}
|
@@ -0,0 +1,156 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
/* This benchmark spawns itself 1000 times. */
|
23
|
+
|
24
|
+
#include "task.h"
|
25
|
+
#include "uv.h"
|
26
|
+
|
27
|
+
static uv_loop_t* loop;
|
28
|
+
|
29
|
+
static int N = 1000;
|
30
|
+
static int done;
|
31
|
+
|
32
|
+
static uv_process_t process;
|
33
|
+
static uv_process_options_t options = { 0 };
|
34
|
+
static char exepath[1024];
|
35
|
+
static size_t exepath_size = 1024;
|
36
|
+
static char* args[3];
|
37
|
+
static uv_pipe_t out;
|
38
|
+
|
39
|
+
#define OUTPUT_SIZE 1024
|
40
|
+
static char output[OUTPUT_SIZE];
|
41
|
+
static int output_used;
|
42
|
+
|
43
|
+
static int process_open;
|
44
|
+
static int pipe_open;
|
45
|
+
|
46
|
+
|
47
|
+
static void spawn();
|
48
|
+
|
49
|
+
|
50
|
+
void maybe_spawn() {
|
51
|
+
if (process_open == 0 && pipe_open == 0) {
|
52
|
+
done++;
|
53
|
+
if (done < N) {
|
54
|
+
spawn();
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
static void process_close_cb(uv_handle_t* handle) {
|
61
|
+
ASSERT(process_open == 1);
|
62
|
+
process_open = 0;
|
63
|
+
maybe_spawn();
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
68
|
+
ASSERT(exit_status == 42);
|
69
|
+
ASSERT(term_signal == 0);
|
70
|
+
uv_close((uv_handle_t*)process, process_close_cb);
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
uv_buf_t on_alloc(uv_handle_t* handle, size_t suggested_size) {
|
75
|
+
uv_buf_t buf;
|
76
|
+
buf.base = output + output_used;
|
77
|
+
buf.len = OUTPUT_SIZE - output_used;
|
78
|
+
return buf;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
void pipe_close_cb(uv_handle_t* pipe) {
|
83
|
+
ASSERT(pipe_open == 1);
|
84
|
+
pipe_open = 0;
|
85
|
+
maybe_spawn();
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
void on_read(uv_stream_t* pipe, ssize_t nread, uv_buf_t buf) {
|
90
|
+
uv_err_t err = uv_last_error(loop);
|
91
|
+
|
92
|
+
if (nread > 0) {
|
93
|
+
ASSERT(pipe_open == 1);
|
94
|
+
output_used += nread;
|
95
|
+
} else if (nread < 0) {
|
96
|
+
if (err.code == UV_EOF) {
|
97
|
+
uv_close((uv_handle_t*)pipe, pipe_close_cb);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
static void spawn() {
|
104
|
+
int r;
|
105
|
+
|
106
|
+
ASSERT(process_open == 0);
|
107
|
+
ASSERT(pipe_open == 0);
|
108
|
+
|
109
|
+
args[0] = exepath;
|
110
|
+
args[1] = "spawn_helper";
|
111
|
+
args[2] = NULL;
|
112
|
+
options.file = exepath;
|
113
|
+
options.args = args;
|
114
|
+
options.exit_cb = exit_cb;
|
115
|
+
|
116
|
+
uv_pipe_init(loop, &out, 0);
|
117
|
+
options.stdout_stream = &out;
|
118
|
+
|
119
|
+
r = uv_spawn(loop, &process, options);
|
120
|
+
ASSERT(r == 0);
|
121
|
+
|
122
|
+
process_open = 1;
|
123
|
+
pipe_open = 1;
|
124
|
+
output_used = 0;
|
125
|
+
|
126
|
+
r = uv_read_start((uv_stream_t*) &out, on_alloc, on_read);
|
127
|
+
ASSERT(r == 0);
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
BENCHMARK_IMPL(spawn) {
|
132
|
+
int r;
|
133
|
+
static int64_t start_time, end_time;
|
134
|
+
|
135
|
+
loop = uv_default_loop();
|
136
|
+
|
137
|
+
r = uv_exepath(exepath, &exepath_size);
|
138
|
+
ASSERT(r == 0);
|
139
|
+
exepath[exepath_size] = '\0';
|
140
|
+
|
141
|
+
uv_update_time(loop);
|
142
|
+
start_time = uv_now(loop);
|
143
|
+
|
144
|
+
spawn();
|
145
|
+
|
146
|
+
r = uv_run(loop);
|
147
|
+
ASSERT(r == 0);
|
148
|
+
|
149
|
+
uv_update_time(loop);
|
150
|
+
end_time = uv_now(loop);
|
151
|
+
|
152
|
+
LOGF("spawn: %.0f spawns/s\n",
|
153
|
+
(double) N / (double) (end_time - start_time) * 1000.0);
|
154
|
+
|
155
|
+
return 0;
|
156
|
+
}
|