#!/opt/perl/bin/perl
#
# Author: Shawn M. Emery
#

for ($i = 0; $i < 6; $i++)
	{ <STDIN>; }

$i = 0;
	
while(<STDIN>)
	{
	$line = $_;

	$line =~ s/\s+/\:/g;
	@numarray = split(/:/, $line);

	$clients{$numarray[1]} += 1;

	$connrate{$numarray[1]} += $numarray[2];
	$tconnrate += $numarray[2];

	$littles{$numarray[1]} += $numarray[3];
	$tlittles += $numarray[3];

	$response{$numarray[1]} += $numarray[4];
	$tresponse += $numarray[4];

	$error{$numarray[1]} += $numarray[5];
	$terror += $numarray[5];

	$through{$numarray[1]} += $numarray[6];
	$tthrough += $numarray[6];

	$i++;
	}

print "Averages:\n";
print "client connrate littles response error  through\n";

while (($key, $value) = each %connrate)
	{
	printf ("%3d", $key);
	printf ("%10.2f", $connrate{$key}/$clients{$key});
	printf ("%8.2f", $littles{$key}/$clients{$key});
	printf ("%9.4f", $response{$key}/$clients{$key});
	printf ("%9.4f", $error{$key}/$clients{$key});
	printf ("%6.2f\n", $through{$key}/$clients{$key});
	}

#print "Total: connrate littles response error  through\n";
#printf ("%13.2f", $tconnrate/$i);
#printf ("%7.2f", $tlittles/$i);
#printf ("%8.2f", $tresponse/$i);
#printf ("%9.2f", $terror/$i);
#printf ("%7.2f\n", $tthrough/$i);
