#!/usr/local/bin/perl5.001
############################################################################
#                                                                          #
# The contents of this file are subject to the WebStone Public License     #
# Version 1.0 (the "License"); you may not use this file except in         #
# compliance with the License. You may obtain a copy of the License        #
# at http://www.mindcraft.com/webstone/license10.html                      #
#                                                                          #
# Software distributed under the License is distributed on an "AS IS"      #
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See      #
# the License for the specific language governing rights and limitations   #
# under the License.                                                       #
#                                                                          #
# The Original Code is WebStone 2.5.                                       #
#                                                                          #
# The Initial Developer of the Original Code is Silicon Graphics, Inc.     #
# and Mindcraft, Inc.. Portions created by Silicon Graphics. and           #
# Mindcraft. are Copyright (C) 1995#1998 Silicon Graphics, Inc. and        #
# Mindcraft, Inc. All Rights Reserved.                                     #
#                                                                          #
# Contributor(s): ______________________________________.                  #
#                                                                          #
############################################################################

push(@INC, "$wd/bin");
require('WebStone-common.pl');

require('wscollect.pl');

$debug = 0;

$printedTitles = 0;

html_begin("Results");

print CLIENT "<H3>WebStone Results</H3>";

($debug) && print STDERR "opening table\n";
print CLIENT "<BODY><TABLE BORDER=1>\r";

@directories = ("$wd/bin/runs");
@runs = ();
directory: for (@directories) {
    &find($_);
}

&printcustom;

($debug) && print STDERR "closing table\n";
print CLIENT "</TABLE></BODY>\r";

html_end();

# end main

sub printcustom {
    if (!$printedTitles) {
	$printedTitles = 1;
	print CLIENT "<TR>";
	for $title (@title) {
	    print CLIENT "<TH>$title</TH>\r";
	} # end for title
	print CLIENT "</TR>\r";
    }
    for $runtime (sort @runs) {
		print CLIENT "<TR>\r";
	    print CLIENT "<TD><A HREF=$wd/bin/runs/$runtime>$runtime</A></TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$numclients{ $runtime}</TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$connrate{ $runtime}</TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$littlesload{ $runtime}</TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$latency{ $runtime}</TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$error{ $runtime}</TD>\r";
	    print CLIENT "<TD ALIGN=RIGHT>$throughput{ $runtime}</TD>\r";
		print CLIENT "</TR>\r";
    } # end for runtime
}

# end
