Refactored seconds setting and worker space reservation

This commit is contained in:
Nora Shoemaker 2015-07-16 11:02:01 -07:00
parent ce00c50720
commit eeba12144c
1 changed files with 2 additions and 4 deletions

View File

@ -1556,16 +1556,14 @@ int main(int argc, char **argv) {
// if in rate mode, create a new worker each second // if in rate mode, create a new worker each second
else { else {
// set various config values // set various config values
config.seconds = std::min(n_time, c_time);
if ((int)config.nreqs < config.nconns) { if ((int)config.nreqs < config.nconns) {
config.seconds = c_time; config.seconds = c_time;
config.workers.reserve(config.seconds);
} else if (config.nconns == 0) { } else if (config.nconns == 0) {
config.seconds = n_time; config.seconds = n_time;
} else { } else {
config.workers.reserve(config.seconds); config.seconds = std::min(n_time, c_time);
} }
config.workers.reserve(config.seconds);
config.conns_remainder = config.nconns % config.rate; config.conns_remainder = config.nconns % config.rate;