Getting rid of unused fields in Worker

This commit is contained in:
Nora Shoemaker 2015-07-23 11:01:09 -07:00
parent 584f5f3734
commit d6786f75cb
2 changed files with 9 additions and 6 deletions

View File

@ -731,11 +731,11 @@ void Client::signal_write() { ev_io_start(worker->loop, &wev); }
Worker::Worker(uint32_t id, SSL_CTX *ssl_ctx, size_t req_todo, size_t nclients,
ssize_t rate, Config *config)
: stats(req_todo), loop(ev_loop_new(0)), ssl_ctx(ssl_ctx), config(config),
id(id), tls_info_report_done(false), rate_loop(EV_DEFAULT), current_second(0), nconns_made(0), nclients(nclients), rate(rate) {
id(id), tls_info_report_done(false), current_second(0), nconns_made(0), nclients(nclients), rate(rate) {
stats.req_todo = req_todo;
progress_interval = std::max((size_t)1, req_todo / 10);
nreqs_per_client = req_todo / nclients;
nreqs_rem = req_todo % nclients;
auto nreqs_per_client = req_todo / nclients;
auto nreqs_rem = req_todo % nclients;
if (config->is_rate_mode()) {
// create timer that will go off every second
@ -1332,6 +1332,12 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
if (config.is_rate_mode() && config.nconns < (ssize_t)config.nthreads) {
std::cerr << "-C, -t: the total number of connections must be greater than or equal "
<< "to the number of threads." << std::endl;
exit(EXIT_FAILURE);
}
if (!datafile.empty()) {
config.data_fd = open(datafile.c_str(), O_RDONLY | O_BINARY);
if (config.data_fd == -1) {

View File

@ -184,12 +184,9 @@ struct Worker {
size_t progress_interval;
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;
ssize_t rate;