fix linux local processs memory, cpu
This commit is contained in:
parent
9f209e0ca5
commit
dbefc2626b
|
@ -115,7 +115,7 @@ sub set_counters {
|
||||||
{ template => '%d', unit => 'B/s', min => 0 }
|
{ template => '%d', unit => 'B/s', min => 0 }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{processes} = [
|
$self->{maps_counters}->{processes} = [
|
||||||
|
@ -269,7 +269,7 @@ sub add_cpu {
|
||||||
# utime (14) Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK))
|
# utime (14) Amount of time that this process has been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK))
|
||||||
# stime (15) Amount of time that this process has been scheduled in kernel mode, measured in clock ticks
|
# stime (15) Amount of time that this process has been scheduled in kernel mode, measured in clock ticks
|
||||||
foreach my $pid (keys %{$self->{processes}}) {
|
foreach my $pid (keys %{$self->{processes}}) {
|
||||||
next if ($options{content} !~ /==>\s*\/proc\/$pid\/stat\s+.*?\n(.*?)\n/ms);
|
next if ($options{content} !~ /==>\s*\/proc\/$pid\/stat\s+.*?\n(.*?)(?:==>|\Z)/ms);
|
||||||
my @values = split(/\s+/, $1);
|
my @values = split(/\s+/, $1);
|
||||||
|
|
||||||
$self->{processes}->{$pid}->{cpu_utime} = $values[13];
|
$self->{processes}->{$pid}->{cpu_utime} = $values[13];
|
||||||
|
@ -288,7 +288,7 @@ sub add_memory {
|
||||||
# data (6) data + stack
|
# data (6) data + stack
|
||||||
# measured in page (default: 4096). can get with: getconf PAGESIZE
|
# measured in page (default: 4096). can get with: getconf PAGESIZE
|
||||||
foreach my $pid (keys %{$self->{processes}}) {
|
foreach my $pid (keys %{$self->{processes}}) {
|
||||||
next if ($options{content} !~ /==>\s*\/proc\/$pid\/statm.*?\n(.*?)\n/ms);
|
next if ($options{content} !~ /==>\s*\/proc\/$pid\/statm.*?\n(.*?)(?:==>|\Z)/ms);
|
||||||
my @values = split(/\s+/, $1);
|
my @values = split(/\s+/, $1);
|
||||||
|
|
||||||
my $memory_used = ($values[1] * $self->{option_results}->{page_size}) + ($values[5] * $self->{option_results}->{page_size});
|
my $memory_used = ($values[1] * $self->{option_results}->{page_size}) + ($values[5] * $self->{option_results}->{page_size});
|
||||||
|
|
Loading…
Reference in New Issue