mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-07 10:27:44 +02:00
timeout estimation code.
git-svn-id: file:///svn/unbound/trunk@317 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
@@ -756,7 +756,8 @@ thread_debug_info(struct thr_check* thr)
|
||||
(thr->arg?*(int*)thr->arg:0));
|
||||
log_info("thread num is %d", thr->num);
|
||||
log_info("locks created %d", thr->locks_created);
|
||||
log_info("FILE for lockinfo: %x. flushing.", (int)thr->order_info);
|
||||
log_info("open file for lockinfo: %s",
|
||||
thr->order_info?"yes, flushing":"no");
|
||||
fflush(thr->order_info);
|
||||
w = thr->waiting;
|
||||
f = thr->holding_first;
|
||||
|
||||
@@ -119,6 +119,30 @@ net_test()
|
||||
unit_assert( !is_pow2(259) );
|
||||
}
|
||||
|
||||
#include "util/rtt.h"
|
||||
/** test RTT code */
|
||||
static void
|
||||
rtt_test()
|
||||
{
|
||||
int i;
|
||||
struct rtt_info r;
|
||||
rtt_init(&r);
|
||||
/* initial value sensible */
|
||||
unit_assert( rtt_timeout(&r) == 3000 );
|
||||
rtt_lost(&r);
|
||||
unit_assert( rtt_timeout(&r) == 6000 );
|
||||
rtt_lost(&r);
|
||||
unit_assert( rtt_timeout(&r) == 12000 );
|
||||
rtt_update(&r, 4000);
|
||||
unit_assert( rtt_timeout(&r) >= 5000 );
|
||||
rtt_lost(&r);
|
||||
for(i=0; i<100; i++) {
|
||||
rtt_lost(&r);
|
||||
unit_assert( rtt_timeout(&r) > RTT_MIN_TIMEOUT-1);
|
||||
unit_assert( rtt_timeout(&r) < RTT_MAX_TIMEOUT+1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main unit test program. Setup, teardown and report errors.
|
||||
* @param argc: arg count.
|
||||
@@ -137,6 +161,7 @@ main(int argc, char* argv[])
|
||||
checklock_start();
|
||||
net_test();
|
||||
dname_test();
|
||||
rtt_test();
|
||||
alloc_test();
|
||||
lruhash_test();
|
||||
slabhash_test();
|
||||
|
||||
Reference in New Issue
Block a user