Commit 03894d63 authored by Leigh Stoller's avatar Leigh Stoller

Hack in plain text output format.

parent 08ed0549
......@@ -7,11 +7,6 @@
include("defs.php3");
include("showstuff.php3");
#
# Standard Testbed Header
#
PAGEHEADER("Wide Area Link Characteristics");
#
# Only known and logged in users can end experiments.
#
......@@ -23,14 +18,26 @@ LOGGEDINORDIE($uid);
#
if (! isset($showtype))
$showtype="delay";
echo "<b>Show:
<a href='widearea_info.php3?showtype=delay'>Delay</a>,
<a href='widearea_info.php3?showtype=bw'>Bandwidth</a>,
<a href='widearea_info.php3?showtype=plr'>Lossrate</a>,
<a href='widearea_info.php3?showtype=dates'>Dates</a>,
<a href='widearea_info.php3?showtype=all'>All</a>.
</b><br><br>\n";
if (! isset($plain))
$plain=0;
if (! $plain) {
PAGEHEADER("Wide Area Link Characteristics");
echo "<b>Show:
<a href='widearea_info.php3?showtype=delay&plain=$plain'>Delay</a>,
<a href='widearea_info.php3?showtype=bw&plain=$plain'>Bandwidth</a>,
<a href='widearea_info.php3?showtype=plr&plain=$plain'>Lossrate</a>,
<a href='widearea_info.php3?showtype=dates&plain=$plain'>Dates</a>,
<a href='widearea_info.php3?showtype=all&plain=$plain'>All</a>. ";
echo "Format:
<a href='widearea_info.php3?showtype=$showtype&plain=1'>Text</a>.";
echo "</b><br><br>\n";
}
else {
header("Content-Type: text/plain");
echo "\n";
}
#
# Convert showtype to quicker compare
......@@ -48,7 +55,7 @@ elseif (!strcmp($showtype, "dates"))
else
$showtype = 1;
function SPITDATA($table, $title, $showtype)
function SPITDATA($table, $title, $showtype, $plain)
{
$query_result1 =
DBQueryFatal("select * from $table order by node_id1");
......@@ -90,43 +97,59 @@ function SPITDATA($table, $title, $showtype)
ksort($nodenamesrow);
ksort($nodenamescol);
echo "<center>
<b>$title</b><br>\n";
if (! $plain) {
echo "<center>
<b>$title</b><br>\n";
if ($showtype == 1)
echo "(Delay,BW,PLR)\n";
elseif ($showtype == 2)
echo "(Delay)\n";
elseif ($showtype == 3)
echo "(BW)\n";
elseif ($showtype == 4)
echo "(PLR)\n";
elseif ($showtype == 5)
echo "(Time Span of Data)\n";
echo "</center><br>\n";
echo "<table border=2
cellpadding=1 cellspacing=2 align=center>
<tr>";
echo "<td>&nbsp</td>\n";
while (list($n1, $ignore1) = each($nodenamescol)) {
echo "<td>$n1</td>\n";
if ($showtype == 1)
echo "(Delay,BW,PLR)\n";
elseif ($showtype == 2)
echo "(Delay)\n";
elseif ($showtype == 3)
echo "(BW)\n";
elseif ($showtype == 4)
echo "(PLR)\n";
elseif ($showtype == 5)
echo "(Time Span of Data)\n";
echo "</center><br>\n";
echo "<table border=2
cellpadding=1 cellspacing=2 align=center>
<tr>";
echo " <td>&nbsp</td>\n";
while (list($n1, $ignore1) = each($nodenamescol)) {
echo "<td>$n1</td>\n";
}
reset($nodenamescol);
echo " </tr>\n";
}
else {
printf("$title:\n");
printf("%10s ", " ");
while (list($n1, $ignore1) = each($nodenamescol)) {
printf("%10s ", $n1);
}
echo "\n";
reset($nodenamescol);
}
reset($nodenamescol);
echo "</tr>\n";
while (list($n1, $ignore1) = each($nodenamesrow)) {
echo "<tr>";
echo " <td>$n1</td>";
if (! $plain) {
echo "<tr>";
echo " <td>$n1</td>";
}
else {
printf("%10s ", "$n1");
}
while (list($n2, $ignore2) = each($nodenamescol)) {
if (strcmp($n1, $n2)) {
$s = 0;
$b = 0;
$p = 0.0;
$d = "&nbsp";
$d = (($plain) ? "" : "&nbsp");
$glom = $n1 . "+" . $n2;
if (isset($speeds[$glom])) {
......@@ -135,37 +158,64 @@ function SPITDATA($table, $title, $showtype)
$p = sprintf("%.2f", $plrs[$glom]);
$d = $dates[$glom];
}
if ($showtype == 1)
echo "<td>$s,$b,$p</td>";
elseif ($showtype == 2)
echo "<td align=center>$s</td>";
elseif ($showtype == 3)
echo "<td align=center>$b</td>";
elseif ($showtype == 4)
echo "<td align=center>$p</td>";
elseif ($showtype == 5)
echo "<td align=center nowrap=1>$d</td>";
if ($plain) {
if ($showtype == 1)
printf("%10s ", "$s,$b,$p");
elseif ($showtype == 2)
printf("%10s ", "$s");
elseif ($showtype == 3)
printf("%10s ", "$b");
elseif ($showtype == 4)
printf("%10s ", "$p");
elseif ($showtype == 5)
printf("%10s ", "$d");
}
else {
if ($showtype == 1)
echo "<td>$s,$b,$p</td>";
elseif ($showtype == 2)
echo "<td align=center>$s</td>";
elseif ($showtype == 3)
echo "<td align=center>$b</td>";
elseif ($showtype == 4)
echo "<td align=center>$p</td>";
elseif ($showtype == 5)
echo "<td align=center nowrap=1>$d</td>";
}
}
else {
echo "<td align=center><img src=blueball.gif alt=0</td>";
if ($plain)
printf("%10s ", "*");
else
echo "<td align=center><img src=blueball.gif alt=0</td>";
}
}
reset($nodenamescol);
echo "</tr>\n";
if (!$plain) {
echo "</tr>";
}
echo " \n";
}
if ($plain) {
echo "\n\n";
}
else {
echo "</table>\n";
echo "<center>
Delay in milliseconds, Bandwidth in KB/s, PLR rounded to two
decimal places (0-100%).
</center>\n";
echo "<br>\n";
}
echo "</table>\n";
echo "<center>
Delay in milliseconds, Bandwidth in KB/s, PLR rounded to two
decimal places (0-100%).
</center>\n";
echo "<br>\n";
}
SPITDATA("widearea_recent", "Most Recent Data", $showtype);
SPITDATA("widearea_delays", "Aged Data", $showtype);
SPITDATA("widearea_recent", "Most Recent Data", $showtype, $plain);
SPITDATA("widearea_delays", "Aged Data", $showtype, $plain);
#
# Standard Testbed Footer
#
PAGEFOOTER();
#
if (! $plain) {
PAGEFOOTER();
}
?>
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