Révision 0c18fb50
memory_by_process: try to be smarted about labels and cleanup field names more deeply
| plugins/system/memory_by_process | ||
|---|---|---|
| 30 | 30 |
{
|
| 31 | 31 |
@a = split; |
| 32 | 32 |
$proc = $a[10]; |
| 33 |
$proc =~ s|.*/||; |
|
| 33 |
$label = $proc; |
|
| 34 |
$proc =~ s/ .*//; |
|
| 35 |
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
|
|
| 34 | 36 |
$proc =~ s/:.*//; |
| 35 | 37 |
$proc =~ tr/[]//d; |
| 36 | 38 |
$proc =~ tr/A-Za-z0-9/_/c; |
| 37 | 39 |
$vsz = $a[4]; |
| 38 | 40 |
$total{$proc} += $vsz;
|
| 41 |
$labels{$proc} = $label;
|
|
| 39 | 42 |
} |
| 40 | 43 |
my $stack = 0; |
| 41 | 44 |
sub draw() { return $stack++ ? "STACK" : "AREA" }
|
| 42 | 45 |
print map |
| 43 | 46 |
{
|
| 44 |
"$_.label $_\n" .
|
|
| 47 |
"$_.label " . $labels{$_} . "\n" .
|
|
| 45 | 48 |
"$_.min 0\n" . |
| 46 | 49 |
"$_.draw " . draw() . "\n" . |
| 47 | 50 |
"$_.cdef $_,1024,*\n" |
| ... | ... | |
| 56 | 59 |
{
|
| 57 | 60 |
@a = split; |
| 58 | 61 |
$proc = $a[10]; |
| 59 |
$proc =~ s|.*/||;
|
|
| 62 |
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
|
|
| 60 | 63 |
$proc =~ s/:.*//; |
| 61 | 64 |
$proc =~ tr/[]//d; |
| 62 | 65 |
$proc =~ tr/A-Za-z0-9/_/c; |
Formats disponibles : Unified diff