Lines Matching refs:worker
170 client->worker->free_client(client); in writecb()
178 client->worker->free_client(client); in writecb()
192 client->worker->free_client(client); in readcb()
204 auto worker = static_cast<Worker *>(w->data); in rate_period_timeout_w_cb() local
205 auto nclients_per_second = worker->rate; in rate_period_timeout_w_cb()
206 auto conns_remaining = worker->nclients - worker->nconns_made; in rate_period_timeout_w_cb()
210 auto req_todo = worker->nreqs_per_client; in rate_period_timeout_w_cb()
211 if (worker->nreqs_rem > 0) { in rate_period_timeout_w_cb()
213 --worker->nreqs_rem; in rate_period_timeout_w_cb()
216 std::make_unique<Client>(worker->next_client_id++, worker, req_todo); in rate_period_timeout_w_cb()
218 ++worker->nconns_made; in rate_period_timeout_w_cb()
224 if (worker->config->is_timing_based_mode()) { in rate_period_timeout_w_cb()
225 worker->clients.push_back(client.release()); in rate_period_timeout_w_cb()
230 worker->report_rate_progress(); in rate_period_timeout_w_cb()
232 if (!worker->config->is_timing_based_mode()) { in rate_period_timeout_w_cb()
233 if (worker->nconns_made >= worker->nclients) { in rate_period_timeout_w_cb()
234 ev_timer_stop(worker->loop, w); in rate_period_timeout_w_cb()
238 assert(worker->nclients == worker->clients.size()); in rate_period_timeout_w_cb()
246 auto worker = static_cast<Worker *>(w->data); in duration_timeout_cb() local
248 worker->current_phase = Phase::DURATION_OVER; in duration_timeout_cb()
250 std::cout << "Main benchmark duration is over for thread #" << worker->id in duration_timeout_cb()
252 worker->stop_all_clients(); in duration_timeout_cb()
253 std::cout << "Stopped all clients for thread #" << worker->id << std::endl; in duration_timeout_cb()
260 auto worker = static_cast<Worker *>(w->data); in warmup_timeout_cb() local
262 std::cout << "Warm-up phase is over for thread #" << worker->id << "." in warmup_timeout_cb()
264 std::cout << "Main benchmark duration is started for thread #" << worker->id in warmup_timeout_cb()
266 assert(worker->stats.req_started == 0); in warmup_timeout_cb()
267 assert(worker->stats.req_done == 0); in warmup_timeout_cb()
269 for (auto client : worker->clients) { in warmup_timeout_cb()
283 worker->current_phase = Phase::MAIN_DURATION; in warmup_timeout_cb()
285 ev_timer_start(worker->loop, &worker->duration_watcher); in warmup_timeout_cb()
296 ev_timer_stop(client->worker->loop, &client->conn_inactivity_watcher); in conn_timeout_cb()
297 ev_timer_stop(client->worker->loop, &client->conn_active_watcher); in conn_timeout_cb()
309 ev_timer_stop(client->worker->loop, w); in check_stop_client_request_timeout()
322 ev_timer_stop(client->worker->loop, w); in client_request_timeout_cb()
327 ev_timer_stop(client->worker->loop, w); in client_request_timeout_cb()
342 ev_timer_stop(client->worker->loop, w); in client_request_timeout_cb()
356 ev_timer_again(client->worker->loop, &client->request_timeout_watcher); in client_request_timeout_cb()
360 Client::Client(uint32_t id, Worker *worker, size_t req_todo) in Client() argument
361 : wb(&worker->mcpool), in Client()
363 worker(worker),
390 worker->config->conn_inactivity_timeout);
394 worker->config->conn_active_timeout, 0.);
408 worker->sample_client_stat(&cstat); in ~Client()
409 ++worker->client_smp.n; in ~Client()
422 ssl = SSL_new(worker->ssl_ctx); in make_socket()
425 auto config = worker->config; in make_socket()
451 if (!worker->config->is_timing_based_mode() || in connect()
452 worker->current_phase == Phase::MAIN_DURATION) { in connect()
456 } else if (worker->current_phase == Phase::INITIAL_IDLE) { in connect()
457 worker->current_phase = Phase::WARM_UP; in connect()
458 std::cout << "Warm-up started for thread #" << worker->id << "." in connect()
460 ev_timer_start(worker->loop, &worker->warmup_watcher); in connect()
463 if (worker->config->conn_inactivity_timeout > 0.) { in connect()
464 ev_timer_again(worker->loop, &conn_inactivity_watcher); in connect()
497 ev_io_start(worker->loop, &wev); in connect()
509 if (worker->config->conn_inactivity_timeout > 0.) { in restart_timeout()
510 ev_timer_again(worker->loop, &conn_inactivity_watcher); in restart_timeout()
522 if (worker->current_phase == Phase::MAIN_DURATION) { in try_again_or_fail()
525 worker->stats.req_failed += req_inflight; in try_again_or_fail()
526 worker->stats.req_error += req_inflight; in try_again_or_fail()
553 ev_timer_stop(worker->loop, &conn_inactivity_watcher); in disconnect()
554 ev_timer_stop(worker->loop, &conn_active_watcher); in disconnect()
555 ev_timer_stop(worker->loop, &request_timeout_watcher); in disconnect()
560 ev_io_stop(worker->loop, &wev); in disconnect()
561 ev_io_stop(worker->loop, &rev); in disconnect()
585 if (worker->current_phase != Phase::MAIN_DURATION) { in submit_request()
589 ++worker->stats.req_started; in submit_request()
592 if (!worker->config->is_timing_based_mode()) { in submit_request()
597 if (worker->config->conn_active_timeout > 0. && req_left == 0) { in submit_request()
598 ev_timer_start(worker->loop, &conn_active_watcher); in submit_request()
605 if (worker->current_phase != Phase::MAIN_DURATION) { in process_timedout_streams()
616 worker->stats.req_timedout += req_inflight; in process_timedout_streams()
622 if (worker->current_phase != Phase::MAIN_DURATION) { in process_abandoned_streams()
628 worker->stats.req_failed += req_abandoned; in process_abandoned_streams()
629 worker->stats.req_error += req_abandoned; in process_abandoned_streams()
636 if (worker->current_phase != Phase::MAIN_DURATION) { in process_request_failure()
640 worker->stats.req_failed += req_left; in process_request_failure()
641 worker->stats.req_error += req_left; in process_request_failure()
648 std::cout << "Process Request Failure:" << worker->stats.req_failed in process_request_failure()
697 if (worker->id == 0 && !worker->tls_info_report_done) { in report_tls_info()
698 worker->tls_info_report_done = true; in report_tls_info()
707 if (worker->id == 0 && !worker->app_info_report_done) { in report_app_info()
708 worker->app_info_report_done = true; in report_app_info()
729 if (worker->current_phase != Phase::MAIN_DURATION) { in on_header()
755 ++worker->stats.status[2]; in on_header()
758 ++worker->stats.status[3]; in on_header()
761 ++worker->stats.status[status / 100]; in on_header()
776 if (worker->current_phase != Phase::MAIN_DURATION) { in on_status_code()
783 ++worker->stats.status[2]; in on_status_code()
786 ++worker->stats.status[3]; in on_status_code()
789 ++worker->stats.status[status / 100]; in on_status_code()
797 if (worker->current_phase == Phase::MAIN_DURATION) { in on_stream_close()
809 ++worker->stats.req_success; in on_stream_close()
813 ++worker->stats.req_status_success; in on_stream_close()
815 ++worker->stats.req_failed; in on_stream_close()
818 worker->sample_req_stat(req_stat); in on_stream_close()
821 ++worker->request_times_smp.n; in on_stream_close()
823 ++worker->stats.req_failed; in on_stream_close()
824 ++worker->stats.req_error; in on_stream_close()
826 ++worker->stats.req_done; in on_stream_close()
829 if (worker->config->log_fd != -1) { in on_stream_close()
851 while (write(worker->config->log_fd, buf.data(), nwrite) == -1 && in on_stream_close()
857 worker->report_progress(); in on_stream_close()
867 ev_feed_event(worker->loop, &request_timeout_watcher, EV_TIMER); in on_stream_close()
996 ev_timer_again(worker->loop, &request_timeout_watcher); in connection_made()
1009 if (worker->current_phase == Phase::MAIN_DURATION) { in on_read()
1010 worker->stats.bytes_total += len; in on_read()
1073 ev_io_start(worker->loop, &wev); in write_clear()
1082 ev_io_stop(worker->loop, &wev); in write_clear()
1091 ev_io_start(worker->loop, &rev); in connected()
1092 ev_io_stop(worker->loop, &wev); in connected()
1120 ev_io_stop(worker->loop, &wev); in tls_handshake()
1123 ev_io_start(worker->loop, &wev); in tls_handshake()
1130 ev_io_stop(worker->loop, &wev); in tls_handshake()
1194 ev_io_start(worker->loop, &wev); in write_tls()
1204 ev_io_stop(worker->loop, &wev); in write_tls()
1252 void Client::signal_write() { ev_io_start(worker->loop, &wev); } in signal_write()
2669 auto &worker = workers.back(); in main() local
2671 std::async(std::launch::async, [&worker, &mu, &cv, &ready]() { in main()
2676 worker->run(); in main()