make output same as sigar_proc_args.c
This commit is contained in:
parent
cd8cab425e
commit
0c78750f61
|
@ -4,8 +4,9 @@ use strict;
|
||||||
|
|
||||||
my $match = $ARGV[0];
|
my $match = $ARGV[0];
|
||||||
|
|
||||||
opendir DH, "/proc" or die;
|
my $proc = "/proc";
|
||||||
chdir "/proc";
|
opendir DH, $proc or die;
|
||||||
|
chdir $proc;
|
||||||
local $/;
|
local $/;
|
||||||
|
|
||||||
while (my $pid = readdir DH) {
|
while (my $pid = readdir DH) {
|
||||||
|
@ -16,7 +17,15 @@ while (my $pid = readdir DH) {
|
||||||
if ($match) {
|
if ($match) {
|
||||||
next unless grep { /$match/o } @cmdline;
|
next unless grep { /$match/o } @cmdline;
|
||||||
}
|
}
|
||||||
print "(pid=$pid) ", (map { "=>$_<=" } @cmdline), "\n";
|
|
||||||
|
print "-------------------------------\n";
|
||||||
|
|
||||||
|
my $i=0;
|
||||||
|
print "pid=$pid\n";
|
||||||
|
for my $arg (@cmdline) {
|
||||||
|
print "$i='$arg'\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir DH;
|
closedir DH;
|
||||||
|
|
Loading…
Reference in New Issue