1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 # ident "%Z%%M% %I% %E% SMI" 27 # 28 29 my $slist = $ARGV[0]; 30 31 open(LST, "<$slist") || die "Cannot open slist"; 32 33 my %hash = (); 34 my %hash1 = (); 35 my @lst = (); 36 my $count = 2000000; 37 #my $count = 1993235; 38 #my $count = 2400000; 39 my $diff = 5; 40 my $ucount = 0; 41 42 while (my $line=<LST>) { 43 44 chomp($line); 45 my @entry = split(/ /, $line); 46 my $upd = 0; 47 48 if (exists($hash{"$entry[1]"})) { 49 my $pos = $hash{"$entry[1]"}; 50 my @lentry = split(/ /, $lst[$pos]); 51 if ($ucount - $lentry[1] <= $diff) { 52 $lentry[0]++; 53 my $lstent = "$lentry[0] $lentry[1] $lentry[2] $lentry[3]"; 54 #print "Updating $lstent\n"; 55 $lst[$pos] = $lstent; 56 $upd = 1; 57 } 58 } 59 if ($upd == 0) { 60 my $lstent = "1 $ucount $line"; 61 #print "$lstent\n"; 62 $#lst++; 63 $lst[$#lst] = $lstent; 64 $hash{"$entry[1]"} = $#lst; 65 $ucount++; 66 } 67 } 68 close(LST); 69 70 foreach $lstent (@lst) { 71 my @lentry = split(/ /, $lstent); 72 #print "$lstent\n"; 73 74 if (exists($hash1{"$lentry[3]"})) { 75 my $hentry = $hash1{"$lentry[3]"}; 76 #print "Got $lentry[3],$lentry[0]: $hentry->[3],$hentry->[0]\n"; 77 if ($lentry[0] > $hentry->[0]) { 78 #print "$hentry->[3] $hentry->[0] swapping to $lentry[3] $lentry[0]\n"; 79 $hentry->[0] = $lentry[0]; 80 $hentry->[1] = $lentry[1]; 81 $hentry->[2] = $lentry[2]; 82 $hentry->[3] = $lentry[3]; 83 $hash1{"$lentry[3]"} = $hentry; 84 85 } elsif ($lentry[0] == $hentry->[0]) { 86 if ($lentry[2] > $hentry->[2]) { 87 $hentry->[0] = $lentry[0]; 88 $hentry->[1] = $lentry[1]; 89 $hentry->[2] = $lentry[2]; 90 $hentry->[3] = $lentry[3]; 91 $hash1{"$lentry[3]"} = $hentry; 92 } 93 } 94 } else { 95 #print "Assigning hash1{$lentry[3]} = \@lentry\n"; 96 $hash1{"$lentry[3]"} = \@lentry; 97 } 98 } 99 100 if (open(PRE, "<$LIVEKIT/iso.sort.pre")) { 101 while ($line=<PRE>) { 102 print $line; 103 } 104 close(PRE); 105 } 106 107 my @vals = (values(%hash1)); 108 @vals = sort({$a->[1] <=> $b->[1]} @vals); 109 foreach my $ventry (@vals) { 110 print "$ventry->[3]\t$count\n"; 111 $count--; 112 } 113 114 print "usr\t$count\n"; 115