BSD-Process

 view release on metacpan or  search on metacpan

eg/showprocattr  view on Meta::CPAN

        next PROC unless $keep;
    }

    unshift @out, $id;
    for my $idx (0..$#out) {
        $width[$idx] = length($out[$idx])
            if $width[$idx] < length($out[$idx]);
    }
    push @line, [@out];
}

exit unless @line;

my @header = ('process', @attr);
for my $idx (0..$#header) {
    $width[$idx] = length($header[$idx])
        if $width[$idx] < length($header[$idx]);
}

my $fmt = join( ' ', map {'%' . -$_ . 's'} @width) . "\n";
printf $fmt, @header;
for my $ln (@line) {
    printf $fmt, @$ln;
}

=head1 NAME

showprocattr - Show attributes of current processes

=head1 SYNOPSIS

B<showprocattr> [B<-nrV>] attr [...]

B<showprocattr> B<-a> [B<-nr>] pid (or 'self') [...]

=head1 DESCRIPTION

Display one or more attributes for all processes currently running
on the system.

=head1 OPTIONS

=over 4

=item B<-a>

All. Show all attributes of a specified pid. The magic label 'self'
corresponds to the running process (hence, your perl interpreter).

=item B<-n>

Non-zero. Only display the process if all requested attributes are non-zero.
When B<-a> is also active, will suppress attributes whose values are zero.

=item B<-q>

Query. Display all the reognised attribute names that may be examined.

=item B<-r>

Resolve. Display uids and gids as names, rather than their numerical
values.

=item B<-V>

Print the version of this program and exit.

=back

=head1 EXAMPLES

C<procshowattr -n kthread>

Show only the processes that are kernel threads.

=head1 SEE ALSO

L<BSD::Process>

=head1 AUTHOR

David Landgren, copyright (C) 2006. All rights reserved.

=head1 LICENSE

This program is free software; you may redistribute it and/or modify
it under the same terms as Perl itself.



( run in 0.667 second using v1.01-cache-2.11-cpan-97f6503c9c8 )