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

Hack in plain text output format.

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