[LON-CAPA-cvs] cvs: modules /gerd monitor.pl

www lon-capa-cvs@mail.lon-capa.org
Tue, 17 Feb 2004 15:32:39 -0000


www		Tue Feb 17 10:32:39 2004 EDT

  Modified files:              
    /modules/gerd	monitor.pl 
  Log:
  Correct most recent "system-wide" to reflect correct total, even as data is
  still gathered.
  
  
Index: modules/gerd/monitor.pl
diff -u modules/gerd/monitor.pl:1.1 modules/gerd/monitor.pl:1.2
--- modules/gerd/monitor.pl:1.1	Mon Feb 16 16:23:40 2004
+++ modules/gerd/monitor.pl	Tue Feb 17 10:32:39 2004
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 $|=1;
 # "Life view" of LON-CAPA cluster
-# $Id: monitor.pl,v 1.1 2004/02/16 21:23:40 www Exp $
+# $Id: monitor.pl,v 1.2 2004/02/17 15:32:39 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -137,6 +137,7 @@
 my %timescnt=();
 my %timessum=();
 my %timesabs=();
+my $firstline=0;
 foreach (keys %FORM) {
     if ($_=~/^timesabs_(.*)$/) {
 	$timesabs{$1}=$FORM{$_};
@@ -164,6 +165,7 @@
 	$timessum{$timeStr}+=$overtime{$_}; 
 	if ($timessum{$timeStr}>$max) { $max=$timessum{$timeStr}; }
     }
+    $firstline=1;
 }
 my $total=0;
 foreach (keys %FORM) {
@@ -178,6 +180,10 @@
    print('<table cellpadding="1" cellspacing="0">');
     foreach (sort { $timesabs{$b}<=>$timesabs{$a} } keys %timesabs) { 
 	my $data=($timessum{$_}?int($timessum{$_}/$timescnt{$_}):0);
+	if ($firstline) {
+	    $firstline=0;
+	    $data=$total;
+	}
 	unless ($host=~/zzz$/) { $overtime{$host.'&'.$_}=$data; }
 	print "\n<tr><td bgcolor='#FFFFAA'><font size='2'><nobr>".$_.'</nobr></font></td><td bgcolor="#BBBBFF"><font size="2">'.$data.'</font></td>'.&bar(100*$data/$max).'</tr>';
     }