Merge branch 'h2load-subsecond-rate-period'
This commit is contained in:
commit
eb3505af02
|
@ -1261,7 +1261,7 @@ std::unique_ptr<Worker> create_worker(uint32_t id, SSL_CTX *ssl_ctx,
|
||||||
std::stringstream rate_report;
|
std::stringstream rate_report;
|
||||||
if (config.is_rate_mode() && nclients > rate) {
|
if (config.is_rate_mode() && nclients > rate) {
|
||||||
rate_report << "Up to " << rate << " client(s) will be created every "
|
rate_report << "Up to " << rate << " client(s) will be created every "
|
||||||
<< std::setprecision(3) << config.rate_period << " seconds. ";
|
<< util::duration_str(config.rate_period) << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "spawning thread #" << id << ": " << nclients
|
std::cout << "spawning thread #" << id << ": " << nclients
|
||||||
|
@ -1379,12 +1379,12 @@ Options:
|
||||||
will run as it normally does, creating connections at
|
will run as it normally does, creating connections at
|
||||||
whatever variable rate it wants. The default value for
|
whatever variable rate it wants. The default value for
|
||||||
this option is 0.
|
this option is 0.
|
||||||
--rate-period=<N>
|
--rate-period=<DURATION>
|
||||||
Specifies the time period between creating connections.
|
Specifies the time period between creating connections.
|
||||||
The period must be a positive number greater than or
|
The period must be a positive number, representing the
|
||||||
equal to 1.0, representing the length of the period in
|
length of the period in time. This option is ignored if
|
||||||
seconds. This option is ignored if the rate option is
|
the rate option is not used. The default value for this
|
||||||
not used. The default value for this option is 1.0.
|
option is 1s.
|
||||||
-T, --connection-active-timeout=<N>
|
-T, --connection-active-timeout=<N>
|
||||||
Specifies the maximum time that h2load is willing to
|
Specifies the maximum time that h2load is willing to
|
||||||
keep a connection open, regardless of the activity on
|
keep a connection open, regardless of the activity on
|
||||||
|
@ -1434,7 +1434,14 @@ Options:
|
||||||
-v, --verbose
|
-v, --verbose
|
||||||
Output debug information.
|
Output debug information.
|
||||||
--version Display version information and exit.
|
--version Display version information and exit.
|
||||||
-h, --help Display this help and exit.)" << std::endl;
|
-h, --help Display this help and exit.
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
The <DURATION> argument is an integer and an optional unit (e.g., 1s
|
||||||
|
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
|
||||||
|
(hours, minutes, seconds and milliseconds, respectively). If a unit
|
||||||
|
is omitted, a second is used as unit.)" << std::endl;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -1629,26 +1636,15 @@ int main(int argc, char **argv) {
|
||||||
// npn-list option
|
// npn-list option
|
||||||
config.npn_list = util::parse_config_str_list(optarg);
|
config.npn_list = util::parse_config_str_list(optarg);
|
||||||
break;
|
break;
|
||||||
case 5: {
|
case 5:
|
||||||
// rate-period
|
// rate-period
|
||||||
const char *start = optarg;
|
config.rate_period = util::parse_duration_with_unit(optarg);
|
||||||
char *end;
|
if (!std::isfinite(config.rate_period)) {
|
||||||
errno = 0;
|
std::cerr << "--rate-period: value error " << optarg << std::endl;
|
||||||
auto v = std::strtod(start, &end);
|
|
||||||
|
|
||||||
if (v < 1.0 || !std::isfinite(v) || end == start || errno != 0) {
|
|
||||||
auto error = errno;
|
|
||||||
std::cerr << "Rate period value error " << optarg << std::endl;
|
|
||||||
if (error != 0) {
|
|
||||||
std::cerr << "\n\t" << strerror(error) << std::endl;
|
|
||||||
}
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.rate_period = v;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -659,9 +659,10 @@ int64_t parse_uint(const std::string &s);
|
||||||
// Parses NULL terminated string |s| as unsigned integer and returns
|
// Parses NULL terminated string |s| as unsigned integer and returns
|
||||||
// the parsed integer casted to double. If |s| ends with "s", the
|
// the parsed integer casted to double. If |s| ends with "s", the
|
||||||
// parsed value's unit is a second. If |s| ends with "ms", the unit
|
// parsed value's unit is a second. If |s| ends with "ms", the unit
|
||||||
// is millisecond. If none of them are given, the unit is second.
|
// is millisecond. Similarly, it also supports 'm' and 'h' for
|
||||||
// This function returns std::numeric_limits<double>::infinity() if
|
// minutes and hours respectively. If none of them are given, the
|
||||||
// error occurs.
|
// unit is second. This function returns
|
||||||
|
// std::numeric_limits<double>::infinity() if error occurs.
|
||||||
double parse_duration_with_unit(const char *s);
|
double parse_duration_with_unit(const char *s);
|
||||||
|
|
||||||
// Returns string representation of time duration |t|. If t has
|
// Returns string representation of time duration |t|. If t has
|
||||||
|
|
Loading…
Reference in New Issue