From 650e463a4971aa591b8844fbd23189ab6a5913df Mon Sep 17 00:00:00 2001 From: Nora Shoemaker Date: Tue, 21 Jul 2015 11:28:12 -0700 Subject: [PATCH] First try with something working, still need to clean and test --- src/h2load.cc | 7 +++---- src/h2load.h | 6 ++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/h2load.cc b/src/h2load.cc index 014985e2..2cff0e61 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -176,7 +176,7 @@ void second_timeout_w_cb(EV_P_ ev_timer *w, int revents) { ++worker->nconns_made; } if (worker->current_second >= std::max((ssize_t)0, (worker->config->seconds - 1))) { - ev_timer_stop(worker->rate_loop, w); + ev_timer_stop(worker->loop, w); } ++worker->current_second; } @@ -742,11 +742,10 @@ Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients, if (config->is_rate_mode()) { // create timer that will go off every second - ev_timer timeout_watcher; + //ev_timer timeout_watcher; timeout_watcher.data = this; ev_init(&timeout_watcher, second_timeout_w_cb); timeout_watcher.repeat = 1.; - ev_timer_again(rate_loop, &timeout_watcher); } else { for (size_t i = 0; i < nclients; ++i) { auto req_todo = nreqs_per_client; @@ -775,7 +774,7 @@ void Worker::run() { } } } else { - ev_run(rate_loop, 0); + ev_timer_again(loop, &timeout_watcher); } ev_run(loop, 0); } diff --git a/src/h2load.h b/src/h2load.h index b71d2263..06e13b1b 100644 --- a/src/h2load.h +++ b/src/h2load.h @@ -185,6 +185,12 @@ struct Worker { uint32_t id; bool tls_info_report_done; struct ev_loop *rate_loop; + ssize_t current_second; + ssize_t nconns_made; + ssize_t nclients; + ssize_t nreqs_per_client; + ssize_t nreqs_rem; + ev_timer timeout_watcher; Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t nreq_todo, size_t nclients, Config *config);