clang-format
This commit is contained in:
parent
c9b1c91944
commit
afcd8d9ab1
|
@ -449,15 +449,15 @@ int Client::make_socket(addrinfo *addr) {
|
||||||
int Client::connect() {
|
int Client::connect() {
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (!worker->config->is_timing_based_mode()
|
if (!worker->config->is_timing_based_mode() ||
|
||||||
|| worker->current_phase == Phase::MAIN_DURATION) {
|
worker->current_phase == Phase::MAIN_DURATION) {
|
||||||
record_client_start_time();
|
record_client_start_time();
|
||||||
clear_connect_times();
|
clear_connect_times();
|
||||||
record_connect_start_time();
|
record_connect_start_time();
|
||||||
} else if (worker->current_phase == Phase::INITIAL_IDLE) {
|
} else if (worker->current_phase == Phase::INITIAL_IDLE) {
|
||||||
worker->current_phase = Phase::WARM_UP;
|
worker->current_phase = Phase::WARM_UP;
|
||||||
std::cout << "Warm-up started for thread #" << worker->id
|
std::cout << "Warm-up started for thread #" << worker->id << "."
|
||||||
<< "." << std::endl;
|
<< std::endl;
|
||||||
ev_timer_start(worker->loop, &worker->warmup_watcher);
|
ev_timer_start(worker->loop, &worker->warmup_watcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +646,8 @@ void Client::process_request_failure() {
|
||||||
if (req_inflight == 0) {
|
if (req_inflight == 0) {
|
||||||
terminate_session();
|
terminate_session();
|
||||||
}
|
}
|
||||||
std::cout << "Process Request Failure:" << worker->stats.req_failed << std::endl;
|
std::cout << "Process Request Failure:" << worker->stats.req_failed
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -1347,7 +1348,7 @@ void Worker::run() {
|
||||||
client.release();
|
client.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (config->is_rate_mode()){
|
} else if (config->is_rate_mode()) {
|
||||||
ev_timer_again(loop, &timeout_watcher);
|
ev_timer_again(loop, &timeout_watcher);
|
||||||
|
|
||||||
// call callback so that we don't waste the first rate_period
|
// call callback so that we don't waste the first rate_period
|
||||||
|
@ -1384,8 +1385,8 @@ void Worker::sample_client_stat(ClientStat *cstat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::report_progress() {
|
void Worker::report_progress() {
|
||||||
if (id != 0 || config->is_rate_mode() || stats.req_done % progress_interval
|
if (id != 0 || config->is_rate_mode() || stats.req_done % progress_interval ||
|
||||||
|| config->is_timing_based_mode()) {
|
config->is_timing_based_mode()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1745,8 +1746,8 @@ std::unique_ptr<Worker> create_worker(uint32_t id, SSL_CTX *ssl_ctx,
|
||||||
} else {
|
} else {
|
||||||
// Here rate is same as client because the rate_timeout callback
|
// Here rate is same as client because the rate_timeout callback
|
||||||
// will be called only once
|
// will be called only once
|
||||||
return make_unique<Worker>(id, ssl_ctx, nreqs, nclients, nclients, max_samples,
|
return make_unique<Worker>(id, ssl_ctx, nreqs, nclients, nclients,
|
||||||
&config);
|
max_samples, &config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -2029,8 +2030,8 @@ int main(int argc, char **argv) {
|
||||||
{"warm-up-time", required_argument, &flag, 9},
|
{"warm-up-time", required_argument, &flag, 9},
|
||||||
{nullptr, 0, nullptr, 0}};
|
{nullptr, 0, nullptr, 0}};
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
auto c =
|
auto c = getopt_long(argc, argv,
|
||||||
getopt_long(argc, argv, "hvW:c:d:m:n:p:t:w:H:i:r:T:N:D:B:", long_options,
|
"hvW:c:d:m:n:p:t:w:H:i:r:T:N:D:B:", long_options,
|
||||||
&option_index);
|
&option_index);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
break;
|
break;
|
||||||
|
@ -2345,8 +2346,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (config.nreqs == 0 && !config.is_timing_based_mode()) {
|
if (config.nreqs == 0 && !config.is_timing_based_mode()) {
|
||||||
std::cerr << "-n: the number of requests must be strictly greater than 0,"
|
std::cerr << "-n: the number of requests must be strictly greater than 0,"
|
||||||
<< "timing-based test is not being run."
|
<< "timing-based test is not being run." << std::endl;
|
||||||
<< std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2369,7 +2369,8 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// With timing script, we don't distribute config.nreqs to each
|
// With timing script, we don't distribute config.nreqs to each
|
||||||
// client or thread.
|
// client or thread.
|
||||||
if (!config.timing_script && config.nreqs < config.nclients && !config.is_timing_based_mode()) {
|
if (!config.timing_script && config.nreqs < config.nclients &&
|
||||||
|
!config.is_timing_based_mode()) {
|
||||||
std::cerr << "-n, -c: the number of requests must be greater than or "
|
std::cerr << "-n, -c: the number of requests must be greater than or "
|
||||||
<< "equal to the clients." << std::endl;
|
<< "equal to the clients." << std::endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -2377,16 +2378,14 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (config.nclients < config.nthreads) {
|
if (config.nclients < config.nthreads) {
|
||||||
std::cerr << "-c, -t: the number of clients must be greater than or equal "
|
std::cerr << "-c, -t: the number of clients must be greater than or equal "
|
||||||
<< "to the number of threads."
|
<< "to the number of threads." << std::endl;
|
||||||
<< std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.is_timing_based_mode()) {
|
if (config.is_timing_based_mode()) {
|
||||||
if (config.nreqs != 0) {
|
if (config.nreqs != 0) {
|
||||||
std::cerr << "-n: the number of requests needs to be zero (0) for timing-"
|
std::cerr << "-n: the number of requests needs to be zero (0) for timing-"
|
||||||
<< "based test. Default value is 1."
|
<< "based test. Default value is 1." << std::endl;
|
||||||
<< std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2741,7 +2740,8 @@ int main(int argc, char **argv) {
|
||||||
bps = stats.bytes_total / config.duration;
|
bps = stats.bytes_total / config.duration;
|
||||||
} else {
|
} else {
|
||||||
auto secd = std::chrono::duration_cast<
|
auto secd = std::chrono::duration_cast<
|
||||||
std::chrono::duration<double, std::chrono::seconds::period>>(duration);
|
std::chrono::duration<double, std::chrono::seconds::period>>(
|
||||||
|
duration);
|
||||||
rps = stats.req_success / secd.count();
|
rps = stats.req_success / secd.count();
|
||||||
bps = stats.bytes_total / secd.count();
|
bps = stats.bytes_total / secd.count();
|
||||||
}
|
}
|
||||||
|
|
10
src/h2load.h
10
src/h2load.h
|
@ -264,11 +264,13 @@ struct Worker {
|
||||||
ev_timer timeout_watcher;
|
ev_timer timeout_watcher;
|
||||||
// The next client ID this worker assigns
|
// The next client ID this worker assigns
|
||||||
uint32_t next_client_id;
|
uint32_t next_client_id;
|
||||||
// Keeps track of the current phase (for timing-based experiment) for the worker
|
// Keeps track of the current phase (for timing-based experiment) for the
|
||||||
|
// worker
|
||||||
Phase current_phase;
|
Phase current_phase;
|
||||||
// We need to keep track of the clients in order to stop them when needed
|
// We need to keep track of the clients in order to stop them when needed
|
||||||
std::vector<Client*> clients;
|
std::vector<Client *> clients;
|
||||||
// This is only active when there is not a bounded number of requests specified
|
// This is only active when there is not a bounded number of requests
|
||||||
|
// specified
|
||||||
ev_timer duration_watcher;
|
ev_timer duration_watcher;
|
||||||
ev_timer warmup_watcher;
|
ev_timer warmup_watcher;
|
||||||
|
|
||||||
|
@ -284,7 +286,7 @@ struct Worker {
|
||||||
// This function calls the destructors of all the clients.
|
// This function calls the destructors of all the clients.
|
||||||
void stop_all_clients();
|
void stop_all_clients();
|
||||||
// This function frees a client from the list of clients for this Worker.
|
// This function frees a client from the list of clients for this Worker.
|
||||||
void free_client(Client*);
|
void free_client(Client *);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Stream {
|
struct Stream {
|
||||||
|
|
Loading…
Reference in New Issue