5 $LINES = $ENV{'LINES'} || `tput lines`;
7 open LSOF
, '-|', qw
/lsof -n -Fcpi +c0/;
10 ($a, $b) = (/^(.)(.*)/);
17 push @
{$T{$pid}->{$a}},$b;
28 $C{$T{$pid}->{'c'}}->{'nproc'}++;
29 $C{$T{$pid}->{'c'}}->{'inodes'} += scalar @
{$T{$pid}->{'i'}};
34 $C{$c}->{'iperp'} = $C{$c}->{'inodes'} / $C{$c}->{'nproc'};
39 $sortby = $ARGV[0] || "inodes";
40 for $c (sort { $C{$b}->{$sortby} <=> $C{$a}->{$sortby} } keys %C)
42 printf "%-16s %4d prc %5s ino %7.1f i/p\n", $c, $C{$c}->{'nproc'}, $C{$c}->{'inodes'}, $C{$c}->{'iperp'} ;
44 last if ($LINES and $line >= $LINES - 2);