Apache-VMonitor
view release on metacpan or search on metacpan
lib/Apache/VMonitor.pm view on Meta::CPAN
my $uid = $gtop->proc_uid($pid);
my $mem = $gtop->proc_mem($pid);
my $tty = $uid->tty;
$tty = ' ' if $tty == -1;
push @recs, {
cat_id => $cat_id,
count => $cnt,
pid => $pid,
pid_link => fixup_url($self->{url}, pid => $pid),
uid => scalar(getpwuid($state->uid)),
fsize => size_string($mem->size($pid)),
fshare => size_string($mem->share($pid)),
fvsize => size_string($mem->vsize($pid)),
frss => size_string($mem->rss($pid)),
tty => $tty,
state => $state->state,
cmd => $state->cmd,
};
my $len = length $pid;
$max_len{pid} = $len if $len > $max_len{pid};
$len = length $state->cmd;
$max_len{cmd} = $len if $len > $max_len{cmd};
$len = length $uid->tty;
$max_len{tty} = $len if $len > $max_len{tty};
$len = length scalar getpwuid $state->uid;
$max_len{uid} = $len if $len > $max_len{uid};
}
}
return {
max_len => \%max_len,
records => \@recs,
};
}
lib/Apache/VMonitor.pm view on Meta::CPAN
for ($cpu_total, @cpu_times) {
my $key = "cpu_" . shift @cpu_cols;
$data->{rec}->{$key} = $_/100;
}
}
### generic process info
my $proc_info;
# UID and STATE
my $state = $gtop->proc_state($pid);
$proc_info->{uid} = scalar getpwuid $state->uid;
$proc_info->{gid} = scalar getgrgid $state->gid;
$proc_info->{state} = $state->state;
# TTY
my $proc_uid = $gtop->proc_uid($pid);
my $tty = $proc_uid->tty;
$tty = 'None' if $tty == -1;
$proc_info->{tty} = $tty;
# ARGV
$proc_info->{argv} = join " ", @{($gtop->proc_args($pid))[1]};
$data->{proc} = $proc_info;
( run in 0.402 second using v1.01-cache-2.11-cpan-8d75d55dd25 )