Commit dc26410c authored by Dan Gebhardt's avatar Dan Gebhardt

checkin before making some changes to path test scheduling.

parent 50d8b5e8
...@@ -33,7 +33,7 @@ OPERATION NUANCES: ...@@ -33,7 +33,7 @@ OPERATION NUANCES:
latency to the destination, pings will be run sequentially one after latency to the destination, pings will be run sequentially one after
the other. There will be no simultaneous tests of the same type to the same the other. There will be no simultaneous tests of the same type to the same
destination. destination.
- If a node's latency is longer than 60 seconds, an error value is reported - If a path latency is longer than 60 seconds, an error value is reported
instead of a latency (milliseconds) value. See %ERRID instead of a latency (milliseconds) value. See %ERRID
- If a testing process abnormally exits with a value not 0 (say, iperf dies), - If a testing process abnormally exits with a value not 0 (say, iperf dies),
then the test is rescheduled to be run at a future time. This time is then the test is rescheduled to be run at a future time. This time is
...@@ -59,7 +59,8 @@ sub usage { ...@@ -59,7 +59,8 @@ sub usage {
my %MAX_SIMU_TESTS = (latency => "10", my %MAX_SIMU_TESTS = (latency => "10",
bw => "1"); bw => "1");
# ratio of testing period to wait after a test process abnormally exits # percentage of testing period to wait after a test process abnormally exits
# note: 0.1 = 10%
my %TEST_FAIL_RETRY= (latency => 0.3, my %TEST_FAIL_RETRY= (latency => 0.3,
bw => 0.1); bw => 0.1);
#MARK_RELIABLE #MARK_RELIABLE
...@@ -162,20 +163,40 @@ for (my $i = 0; $i < $resultDBlimit; $i++) { ...@@ -162,20 +163,40 @@ for (my $i = 0; $i < $resultDBlimit; $i++) {
} }
} }
my $subtimer_reset = 100;
my $subtimer = $subtimer_reset; #decrement every poll-loop.
while (1) { while (1) {
$subtimer--;
#check for pending received events #check for pending received events
event_poll_blocking($handle,100); event_poll_blocking($handle,100);
#TODO: this loop shouldn't be run every poll loop. #re-try wait Q every $subtimer_reset times through poll loop
#try to run tests on queue #try to run tests on queue
foreach my $testtype (keys %waitq){ if( $subtimer == 0 ){
my $arrlen = scalar(@{$waitq{$testtype}}); foreach my $testtype (keys %waitq){
#DONOT use "foreach" here, since the call to spawnTest may add to waitq my $arrlen = scalar(@{$waitq{$testtype}});
for( my $i = 0; $i < $arrlen; $i++ ){ #DONOT use "foreach" here, since the call to spawnTest
my $destnode = pop @{$waitq{$testtype}}; # may add to waitq
# print "WAIT Q: REMOVED $destnode \n"; for( my $i = 0; $i < $arrlen; $i++ ){
spawnTest( $destnode, $testtype ); #get oldest element. (take off, but put right back until
# sure it got processed)
my $destnode = pop @{$waitq{$testtype}};
push @{$waitq{$testtype}}, $destnode;
if( -1 != spawnTest( $destnode, $testtype ) ){
pop @{$waitq{$testtype}}; #sent successfully, so pop node
}
}
# print "QW-".$testtype."_len=".scalar(@{$waitq{$testtype}})."\n";
if( scalar(@{$waitq{$testtype}}) != 0 ){
print time_all()." $testtype ";
foreach my $node (@{$waitq{$testtype}}){
print "$node ";
}
print "\n";
}
} }
} }
...@@ -279,7 +300,8 @@ while (1) { ...@@ -279,7 +300,8 @@ while (1) {
# print "pid=".$testevents{$destaddr}{$testtype}{"pid"}."\n"; # print "pid=".$testevents{$destaddr}{$testtype}{"pid"}."\n";
#check for new tests ready to run #check for new tests ready to run
if( scalar(@{$waitq{bw}}) == 0 && #WRONG? if( scalar(@{$waitq{bw}}) == 0 &&
if(
$testevents{$destaddr}{$testtype}{"timeOfNextRun"} $testevents{$destaddr}{$testtype}{"timeOfNextRun"}
<= time_all() && <= time_all() &&
$testevents{$destaddr}{$testtype}{"flag_scheduled"} == 1 && $testevents{$destaddr}{$testtype}{"flag_scheduled"} == 1 &&
...@@ -353,6 +375,10 @@ while (1) { ...@@ -353,6 +375,10 @@ while (1) {
last; last;
} }
} }
if( $subtimer == 0 ){
$subtimer = $subtimer_reset;
}
} }
############################################################################# #############################################################################
...@@ -496,7 +522,6 @@ sub spawnTest($$) ...@@ -496,7 +522,6 @@ sub spawnTest($$)
use Errno qw(EAGAIN); use Errno qw(EAGAIN);
#exit and don't fork if the max number of tests is already being run #exit and don't fork if the max number of tests is already being run
if( getRunningTestsCnt($testtype) >= $MAX_SIMU_TESTS{$testtype} ){ if( getRunningTestsCnt($testtype) >= $MAX_SIMU_TESTS{$testtype} ){
# print "Testcnt = ".getRunningTestsCnt($testtype); # print "Testcnt = ".getRunningTestsCnt($testtype);
...@@ -515,7 +540,7 @@ sub spawnTest($$) ...@@ -515,7 +540,7 @@ sub spawnTest($$)
# print "WAIT Q: ADDED $linkdest \n"; # print "WAIT Q: ADDED $linkdest \n";
} }
return 0; return -1;
} }
FORK:{ FORK:{
...@@ -556,6 +581,7 @@ sub spawnTest($$) ...@@ -556,6 +581,7 @@ sub spawnTest($$)
redo FORK; redo FORK;
}else{ die "can't fork: $!\n";} }else{ die "can't fork: $!\n";}
} }
return 0;
} }
sub getRunningTestsCnt($) sub getRunningTestsCnt($)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment