int arg_reqs = -1; // max total requests
int arg_serr; // stop on first error
int arg_slow; // slow start: delay in milliseconds
-int arg_thrd = 1; // number of threads
+int arg_thrd; // number of threads
int arg_usr = 1; // number of users
int arg_wait = 10000; // I/O time out (ms)
if (!hld_cfg_finalize())
goto err;
+ /* This is the location to initialize the default value for <arg_thrd>.
+ * Indeed, global.nthread is initialized late(after the parsing step).
+ */
+ if (arg_thrd == 0)
+ arg_thrd = global.nbthread;
+
+ if (arg_rate && arg_thrd > arg_usr) {
+ ha_alert("Thread count (%d) must not exceed connection count (%d)\n",
+ arg_thrd, arg_usr);
+ goto err;
+ }
+
+ BUG_ON(arg_thrd != global.nbthread);
+
/* Consider the case where <arg_reqs> < <arg_usr> */
if (arg_reqs != -1 && arg_reqs < arg_usr)
arg_usr = arg_reqs;
" -n <reqs> maximum total requests (-1)\n"
" -r <reqs> number of requests per connection (-1)\n"
" -s <time> soft start: time in sec to reach 100%% load\n"
- " -t <threads> number of threads (1)\n"
+ " -t <threads> force number of threads (nbthread)\n"
" -u <users> number of users (1)\n"
" -w <time> I/O timeout in milliseconds (10000)\n"
" -A ignore 1st req for resp time measurements\n"
"URL format:\n"
" (http|https|quic)://<addr>:<port>/<path>\n"
"Note: Options marked with an asterisk (*) are positional and MUST be placed\n"
- " BEFORE the URLs they are intended to affect.\n",
+ " BEFORE the URLs they are intended to affect.\n"
+ "Note: When <arg_rate> is set, <arg_thrd> must be lesser or equal to <arg_usr>\n",
name);
exit(1);
}
goto leave;
}
- if (arg_thrd > arg_usr) {
- ha_alert("Thread count must not exceed connection count\n");
- goto leave;
- }
-
/* "global" section */
hbuf_appendf(&buf, "%.*s", (int)gbuf.data, gbuf.area);
- hbuf_appendf(&buf, "\tnbthread %d\n", arg_thrd);
+ if (arg_thrd != 0)
+ hbuf_appendf(&buf, "\tnbthread %d\n", arg_thrd);
if (arg_mreqs)
hbuf_appendf(&buf,
"\ttune.h2.be.max-concurrent-streams %d\n", arg_mreqs);