mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Try to improve rrl timing
Add a +burst option to mdig so that we have a second to setup the mdig calls then they run at the start of the next second. RRL uses 'queries in a second' as a approximation to 'queries per second'. Getting the bursts of traffic to all happen in the same second should prevent false negatives in the system test. We now have a second to setup the traffic in. Then the traffic should be sent at the start of the next second. If that still fails we should move to +burst=<now+2> (further extend mdig) instead of the implicit <now+1> as the trigger second.
This commit is contained in:
@@ -83,10 +83,15 @@
|
||||
#define UDPTIMEOUT 5
|
||||
#define MAXTRIES 0xffffffff
|
||||
|
||||
#define NS_PER_US 1000 /*%< Nanoseconds per microsecond. */
|
||||
#define US_PER_SEC 1000000 /*%< Microseconds per second. */
|
||||
#define US_PER_MS 1000 /*%< Microseconds per millisecond. */
|
||||
|
||||
static isc_mem_t *mctx;
|
||||
static dns_requestmgr_t *requestmgr;
|
||||
static const char *batchname;
|
||||
static FILE *batchfp;
|
||||
static bool burst = false;
|
||||
static bool have_ipv4 = false;
|
||||
static bool have_ipv6 = false;
|
||||
static bool have_src = false;
|
||||
@@ -1222,18 +1227,29 @@ plus_option(char *option, struct query *query, bool global) {
|
||||
GLOBAL();
|
||||
besteffort = state;
|
||||
break;
|
||||
case 'u': /* bufsize */
|
||||
FULLCHECK("bufsize");
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
if (!state) {
|
||||
case 'u':
|
||||
switch (cmd[2]) {
|
||||
case 'f': /* bufsize */
|
||||
FULLCHECK("bufsize");
|
||||
if (value == NULL) {
|
||||
goto need_value;
|
||||
}
|
||||
if (!state) {
|
||||
goto invalid_option;
|
||||
}
|
||||
result = parse_uint(&num, value, COMMSIZE,
|
||||
"buffer size");
|
||||
CHECK("parse_uint(buffer size)", result);
|
||||
query->udpsize = num;
|
||||
break;
|
||||
case 'r': /* burst */
|
||||
FULLCHECK("burst");
|
||||
GLOBAL();
|
||||
burst = state;
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
result = parse_uint(&num, value, COMMSIZE,
|
||||
"buffer size");
|
||||
CHECK("parse_uint(buffer size)", result);
|
||||
query->udpsize = num;
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
@@ -2044,6 +2060,21 @@ parse_args(bool is_batchfile, int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
static void
|
||||
usleep(unsigned int usec) {
|
||||
HANDLE timer;
|
||||
LARGE_INTEGER ft;
|
||||
|
||||
ft.QuadPart = -(10 * (__int64)usec);
|
||||
|
||||
timer = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||
SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0);
|
||||
WaitForSingleObject(timer, INFINITE);
|
||||
CloseHandle(timer);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*% Main processing routine for mdig */
|
||||
int
|
||||
main(int argc, char *argv[]) {
|
||||
@@ -2152,6 +2183,32 @@ main(int argc, char *argv[]) {
|
||||
query = ISC_LIST_HEAD(queries);
|
||||
RUNCHECK(isc_app_onrun(mctx, task, sendqueries, query));
|
||||
|
||||
/*
|
||||
* Stall to the start of a new second.
|
||||
*/
|
||||
if (burst) {
|
||||
isc_time_t start, now;
|
||||
RUNCHECK(isc_time_now(&start));
|
||||
/*
|
||||
* Sleep to 1ms of the end of the second then run a busy loop
|
||||
* until the second changes.
|
||||
*/
|
||||
do {
|
||||
RUNCHECK(isc_time_now(&now));
|
||||
if (isc_time_seconds(&start) == isc_time_seconds(&now))
|
||||
{
|
||||
int us = US_PER_SEC -
|
||||
(isc_time_nanoseconds(&now) /
|
||||
NS_PER_US);
|
||||
if (us > US_PER_MS) {
|
||||
usleep(us - US_PER_MS);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
(void)isc_app_run();
|
||||
|
||||
query = ISC_LIST_HEAD(queries);
|
||||
|
Reference in New Issue
Block a user