Subject: | Can't get memory infomation on Solaris 10 |
Date: | Mon, 1 Feb 2010 14:53:10 +0100 (CET) |
To: | <bug-Proc-ProcessTable [...] rt.cpan.org> |
From: | "Stefano Favaro" <stefano.favaro [...] epress.it> |
Good Morning,
I'm writing a perl script to collect information about process running for
a specific user. I'm using module Proc-ProcessTable 0.45 for retrieving
all the info I need.
My script should work on either Linux and Solaris.
On Linux I have no problem, I can collect everything and I'm happy with
it.
On Solaris I cannot collect memory information about some processes. For
example I have to collect memory information for 9 processes but I have
success for just 4 of them. For other processes I always get 0. This is
valid for either rss and size fileds.
This is how I get the information:
$tobj = new Proc::ProcessTable;
$proctable = $tobj->table( );
foreach $pn (@process_name) {
for (@$proctable){
# Reading inside user's processes if process matches
configuration file
if ($_->uid eq $> && $_->cmndline =~
$process_cmdname[$num_var] && $_->fname eq $pn && $_->ppid == 1) {
$values{$process_cmdname[$num_var]}->{memory}=$_->size;
# Virtual Memory
$values{$process_cmdname[$num_var]}->{resident}=$_->rss;
# Resident Memory
}
}
}
@process_name is an array containing the list of the process to check.
If I dump the content of the process table I see 0 as the value returned:
bless( {
'priority' => '0',
'euid' => 102,
'wchan' => '0',
'cmndline' =>
'/methode/meth02/mnt/idx/autonomy/DRE1/DRE1.exe',
'pctmem' => ' 2.29',
'time' => '13935',
'fname' => 'DRE1.exe',
'sess' => 4384,
'egid' => 101,
'numthr' => 20,
'state' => 'onprocessor',
'size' => '0',
'nice' => '20',
'pid' => 14231,
'ttynum' => '-1',
'ctime' => '0',
'onpro' => 28,
'uid' => 102,
'flags' => '33554432',
'ctimensec' => 0,
'pctcpu' => ' 0.41',
'ppid' => 1,
'timensec' => 406776752,
'rss' => '0',
'pgrp' => 13069,
'start' => '1264739124',
'gid' => 101,
'ttydev' => ''
}, 'Proc::ProcessTable::Process' ),
These are my information:
Module: Proc-ProcessTable 0.45
Solaris 10: 5.10 Generic_120011-14 sun4v sparc SUNW,Sun-Fire-T1000
Perl: perl, v5.8.8 built
Thanks and reagards,
Show quoted text
______________________________
Stefano Favaro
ePress Information Services s.r.l.
Viale Legioni Romane, 43
20147 Milano
Tel: +39 02 30174525
Fax: +39 02 30174525
Cell: +39 340 1849160
Message body is not shown because it is too large.