[LON-CAPA-cvs] cvs: loncom /debugging_tools login_count.pl

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 30 Mar 2005 17:18:05 -0000


albertel		Wed Mar 30 12:18:05 2005 EDT

  Modified files:              
    /loncom/debugging_tools	login_count.pl 
  Log:
  - add machine count
  
  
Index: loncom/debugging_tools/login_count.pl
diff -u loncom/debugging_tools/login_count.pl:1.3 loncom/debugging_tools/login_count.pl:1.4
--- loncom/debugging_tools/login_count.pl:1.3	Wed Sep  8 15:41:23 2004
+++ loncom/debugging_tools/login_count.pl	Wed Mar 30 12:18:04 2005
@@ -16,6 +16,7 @@
 
 my %data;
 my $numusers;
+my %machine;
 sub process_activitylog_file {
     if ($File::Find::dir=~m|/\d/\d/\d/|) { return; }
     if ($_ ne 'activity.log') {	return; }
@@ -24,8 +25,9 @@
     my $user=(split('/',$File::Find::dir))[-1];
     while (my $line=<FILE>) {
 	if ($line !~ /Login/) { next; }
-	my ($date)=split(':',$line,2);
+	my ($date,$machine)=split(':',$line,3);
 	if ($date > $start_time) { push (@{$data{$date}},$user);	}
+	$machine{$machine}++;
     }
     if ($numusers%100 == 0) {
 	print "\b\b\b\b\b\b\b\b\b\b\b\b\b\bDid $user";
@@ -52,6 +54,10 @@
     	print("$key -> $byday{$key}\n");
     }
     print("total -> $total_login\n");
+    print("\nMachine Logins\n");
+    foreach my $key (sort(keys(%machine))) {
+	print("$key \t-> $machine{$key}\n");
+    }
 }
 
 $|=1;