First try with something working, still need to clean and test
This commit is contained in:
parent
52152ad96d
commit
650e463a49
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue