Commit b8bd80de authored by Pramod R Sanaga's avatar Pramod R Sanaga
Browse files

A couple of bug fixes to the code creating equivalence classes. Now warning are

printed out to indicates paths which do not obey the transitive property.
parent 6569a40b
......@@ -88,7 +88,7 @@ foreach $conditionLine (@initialConditions)
$elabMap{$srcAddress} = "elabc-elab-" . $2;
}
# Create a mapping of the initial conditions.
# Create a mapping of the initial conditions.
$bwMap{$1}{$3} = $4;
$delayMap{$1}{$3} = $5;
}
......@@ -101,8 +101,8 @@ my %addrNodeMapping = {};
foreach $sourceName (readdir(logsDirHandle))
{
# Map the elab IP address in the initial conditions file, with
# the node names in the gather-results logs directory.
# Map the elab IP address in the initial conditions file, with
# the node names in the gather-results logs directory.
if( (-d $logsDir . "/" . $sourceName ) && $sourceName ne "." && $sourceName ne ".." )
{
......@@ -120,8 +120,8 @@ foreach $sourceName (readdir(logsDirHandle))
{
my @destLists;
# Then search for all possible destinations for
# a particular source.
# Then search for all possible destinations for
# a particular source.
opendir(sourceDirHandle, $logsDir . "/" . $sourceName);
foreach $destOne (readdir(sourceDirHandle))
......@@ -129,8 +129,8 @@ foreach $sourceName (readdir(logsDirHandle))
if( (-d $logsDir . "/" . $sourceName . "/" . $destOne) && $destOne ne "." && $destOne ne ".." )
{
# Inside each destination directory, look for
# all possible second destinations.
# Inside each destination directory, look for
# all possible second destinations.
opendir(destDirHandle, $logsDir . "/" . $sourceName . "/" . $destOne);
foreach $destTwo (readdir(destDirHandle))
......@@ -138,8 +138,8 @@ foreach $sourceName (readdir(logsDirHandle))
if( (-d $logsDir . "/" . $sourceName . "/" . $destOne . "/" . $destTwo) && $destTwo ne "." && $destTwo ne ".." )
{
$fullPath = "$logsDir/$sourceName/$destOne/$destTwo";
# Run Rubenstein's code on the ".filter" files
# inside the second destination directory.
# Run Rubenstein's code on the ".filter" files
# inside the second destination directory.
`perl /proj/tbres/duerig/testbed/pelab/bw-bottleneck/dump2filter.pl $fullPath`;
$DansScript = "/proj/tbres/duerig/filter/genjitco.FreeBSD";
$filterFile1 = $fullPath . "/" . "source.filter";
......@@ -161,12 +161,12 @@ foreach $sourceName (readdir(logsDirHandle))
# $scriptOutput[0] = "last CHANGE was CORRELATED, corr case: 30203 pkts, test case: 30203 pkts";
# $scriptOutput[1] = "testingabcdef";
# "CORRELATED" means that these two nodes have
# a shared bottleneck.
# "CORRELATED" means that these two nodes have
# a shared bottleneck.
if($scriptOutput[$#scriptOutput - 1] =~ /last CHANGE\s(\w*)\s(\w*)\,[\w\d\W\:\,]*/)
{
print "For source $sourceName: Comparing $destOne $destTwo: $scriptOutput[$#scriptOutput] \n";
print "For source $sourceName: Comparing $destOne $destTwo: $scriptOutput[$#scriptOutput]";
if($2 eq "CORRELATED")
{
push(@{ $bottleNecks{$sourceName} },$destOne . ":" . $destTwo);
......@@ -203,14 +203,14 @@ foreach $sourceName (readdir(logsDirHandle))
}
closedir(sourceDirHandle);
# Make an adjacency matrix.
# Make an adjacency matrix.
my @destSeen = ();
local @destSeen = ();
my $flagDestOne = 0;
my $flagDestTwo = 0;
# Count the number of unique destinations which have measurements
# from this source node.
# Count the number of unique destinations which have measurements
# from this source node.
my $numDests = 0;
my %destHash;
$tmpName = "";
......@@ -238,7 +238,7 @@ foreach $sourceName (readdir(logsDirHandle))
local @adjMatrix = ();
# Zero out the adjacency matrix.
# Zero out the adjacency matrix.
for($i = 0; $i < $numDests; $i++)
{
for($j = 0; $j < $numDests; $j++)
......@@ -265,8 +265,8 @@ foreach $sourceName (readdir(logsDirHandle))
if($adjMatrix[$i][$j] == 1)
{
# Check if any of these destinations is already in an equivalence class.
# If it is, then add the second destination to that class ( do some sanity checking ).
# Check if any of these destinations is already in an equivalence class.
# If it is, then add the second destination to that class ( do some sanity checking ).
$firstDestFlag = 0;
$secondDestFlag = 0;
$firstDestClassNum = 0;
......@@ -291,10 +291,15 @@ foreach $sourceName (readdir(logsDirHandle))
$secondDestClassNum = $equivClassNum;
}
}
if($firstDestFlag == 1 or $secondDestFlag == 1)
{
last;
}
$equivClassNum++;
}
# Both these destinations are already in an equivalence class - do nothing.
# Both these destinations are already in an equivalence class - do nothing.
if($firstDestFlag == 1 && $secondDestFlag == 1)
{
if($firstDestClassNum != $secondDestClassNum)
......@@ -306,11 +311,11 @@ foreach $sourceName (readdir(logsDirHandle))
}
elsif($firstDestFlag == 1) # Add the second destinaton to the equivalence class.
{
push(@{ $equivClasses[$secondDestClassNum] }, $j);
push(@{ $equivClasses[$firstDestClassNum] }, $j);
}
elsif($secondDestFlag == 1) # Add the first destination to the equivalence class.
{
push(@{ $equivClasses[$firstDestClassNum] }, $i);
push(@{ $equivClasses[$secondDestClassNum] }, $i);
}
else # Create a new equivalence class, and put these two destinations in it.
{
......@@ -321,16 +326,18 @@ foreach $sourceName (readdir(logsDirHandle))
$equivClasses[$numEquivClasses] = [ @newEquivClass ];
$numEquivClasses++;
}
}
}
}
# After processing all the ".filter" files for each of
# the sources, try to find equivalence classes
# from each source. Check to ensure that the
# transitive property is not being violated.
# After processing all the ".filter" files for each of
# the sources, try to find equivalence classes
# from each source. Check to ensure that the
# transitive property is not being violated.
# For debugging.
$retVal = &checkSanity(@equivClasses, @adjMatrix);
......@@ -338,22 +345,21 @@ foreach $sourceName (readdir(logsDirHandle))
{
print "WARNING:($sourceName) Transitive property has been violated.\n";
}
$nodeClasses{$sourceName} = [ @equivClasses ];
# For debugging.
# print " $sourceName\n";
# foreach $tmpName (@equivClasses)
# print "(Debugging) Equivalence classes - $sourceName\n";
#foreach $tmpName (@equivClasses)
# {
# foreach $tmpName2 (@$tmpName)
# {
# print $tmpName2 . " ";
# print $destSeen[$tmpName2] . " ";
# }
# print "\n";
#
# }
# Send the events to all the nodes which form an equivalent class.
$nodeClasses{$sourceName} = [ @equivClasses ];
# Send the events to all the nodes which form an equivalent class.
foreach $tmpName (@equivClasses)
{
my $bwEventCommand = "$tevc $elabMap{$addrNodeMapping{$sourceName}} modify DEST=";
......@@ -361,7 +367,7 @@ foreach $sourceName (readdir(logsDirHandle))
my $maxBw = 0;
# Find the maximum available bandwidth in all the paths of this equivalence class.
# Find the maximum available bandwidth in all the paths of this equivalence class.
foreach $tmpName2 (@$tmpName)
{
if($bwMap{$addrNodeMapping{$sourceName}}{$addrNodeMapping{$destSeen[$tmpName2]}} > $maxBw)
......@@ -387,17 +393,17 @@ foreach $sourceName (readdir(logsDirHandle))
my $delayEventCommand = "$tevc ".$elabMap{$addrNodeMapping{$destSeen[$tmpName2]}}." modify DEST=" . $addrNodeMapping{$destSeen[$tmpName2]}." SRC=".$addrNodeMapping{$sourceName};
$delayEventCommand = $delayEventCommand . " " . "DELAY=" . ($delayMap{$addrNodeMapping{$sourceName}}{$addrNodeMapping{$destSeen[$tmpName2]}});
# Execute the delay event command.
# Execute the delay event command.
print "EXECUTE $delayEventCommand\n";
`$delayEventCommand`;
}
$bwEventCommand = $bwEventCommand . " " . "BANDWIDTH=" . $maxBw;
# Execute the event to set the bandwidth for this equivalence class.
# Execute the event to set the bandwidth for this equivalence class.
print "EXECUTE $bwEventCommand\n";
`$bwEventCommand`;
}
# Create and send events for all the loner dest nodes reachable from this source node.
# Create and send events for all the loner dest nodes reachable from this source node.
for($i = 0; $i < $numDests; $i++)
{
my $lonerFlag = 0;
......@@ -416,7 +422,7 @@ foreach $sourceName (readdir(logsDirHandle))
$bwEventCommand = $bwEventCommand . $addrNodeMapping{$destSeen[$i]};
$bwEventCommand = $bwEventCommand . " BANDWIDTH=".$bwMap{$addrNodeMapping{$sourceName}}{$addrNodeMapping{$destSeen[$i]}};
# Execute the event to set the bandwidth for this path.
# Execute the event to set the bandwidth for this path.
print "EXECUTE: $bwEventCommand\n";
`$bwEventCommand`;
......@@ -424,7 +430,7 @@ foreach $sourceName (readdir(logsDirHandle))
$delayEventCommand = $delayEventCommand . " " . "DELAY=" . ($delayMap{$addrNodeMapping{$sourceName}}{$addrNodeMapping{$destSeen[$i]}});
# Execute the delay event command.
# Execute the delay event command.
print "EXECUTE: $delayEventCommand\n";
`$delayEventCommand`;
}
......@@ -452,6 +458,7 @@ sub checkSanity()
{
if($adjMatrix[$classElement][$secondIter] != 1)
{
print "WARNING: $destSeen[$classElement] $destSeen[$secondIter] violates transitive property\n";
$adjMatrix[$classElement][$secondIter] = 1;
$retVal = -1;
}
......
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