From c6facaf6621da44daf68888060557b775bb743af Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 6 May 2016 23:40:55 +0900 Subject: [PATCH] h2load: Enable kqueue if it is available in the running platform --- src/h2load.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/h2load.cc b/src/h2load.cc index d5046038..b70a0084 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -1136,10 +1136,20 @@ void Client::signal_write() { ev_io_start(worker->loop, &wev); } void Client::try_new_connection() { new_connection_requested = true; } +namespace { +int get_ev_loop_flags() { + if (ev_supported_backends() & ~ev_recommended_backends() & EVBACKEND_KQUEUE) { + return ev_recommended_backends() | EVBACKEND_KQUEUE; + } + + return 0; +} +} // namespace + Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients, size_t rate, size_t max_samples, Config *config) : stats(req_todo, nclients), - loop(ev_loop_new(0)), + loop(ev_loop_new(get_ev_loop_flags())), ssl_ctx(ssl_ctx), config(config), id(id),