[EDGE-877] [h2load] apply changes to new version of h2load

This commit is contained in:
Nora Shoemaker 2015-07-14 23:41:29 +00:00
parent 6b53f7ee19
commit d6551de8d4
2 changed files with 35 additions and 0 deletions

View File

@ -1408,7 +1408,41 @@ int main(int argc, char **argv) {
if (config.max_concurrent_streams == -1) {
config.max_concurrent_streams = reqlines.size();
}
// if not in rate mode and -C is set, warn that we are ignoring it
if (!config.is_rate_mode() && config.nconns != 0) {
std::cerr << "-C: warning: This option can only be used with -r, and"
<< " will be ignored otherwise." << std::endl;
}
ssize_t n_time = 0;
ssize_t c_time = 0;
// only care about n_time and c_time in rate mode
if (config.is_rate_mode() && config.max_concurrent_streams != 0) {
n_time = (int)config.nreqs /
((int)config.rate * (int)config.max_concurrent_streams);
c_time = (int)config.nconns / (int)config.rate;
}
// check to see if the two ways of determining test time conflict
if (config.is_rate_mode() && (int)config.max_concurrent_streams != 0 &&
(n_time != c_time) && config.nreqs != 1 && config.nconns != 0) {
if ((int)config.nreqs < config.nconns) {
std::cerr << "-C, -n: warning: two different test times are being set. "
<< std::endl;
std::cerr << "The test will run for "
<< c_time
<< " seconds." << std::endl;
}
else {
std::cout << "-C, -n: warning: two different test times are being set. "
<< std::endl;
std::cout << "The smaller of the two will be chosen and the test will "
<< "run for "
<< std::min(n_time, c_time)
<< " seconds." << std::endl;
}
}
Headers shared_nva;
shared_nva.emplace_back(":scheme", config.scheme);
if (config.port != config.default_port) {

View File

@ -57,6 +57,7 @@ using namespace nghttp2;
namespace h2load {
class Session;
struct Worker;
struct Config {
std::vector<std::vector<nghttp2_nv>> nva;