I already have a function to get memory usage, borrowed from Zpache::SizeLimit and modified.
sub linux_memory_size { my($size, $resident, $share) = (0, 0, 0); my $file = "/proc/self/statm"; if (open my $fh, "<$file") { ($size, $resident, $share) = split /\s/, scalar <$fh>; close $fh; } else { error_log("Fatal Error: couldn't access $file"); } # linux on intel x86 has 4KB page size... #return ($size * 4, $share * 4); return $size * 4; } --- David Nicol <[EMAIL PROTECTED]> wrote: > On 5/10/05, Igor Chudov <[EMAIL PROTECTED]> wrote: > > LogHandler seems > > like such a place. > > Undoubtably. But how do you get the memory usage? > read /proc/$$/mem or > something? there is not, AFAICTFRAQG (as far as I > can tell from recollection > and quick googling) a line noise variable for > current memory usage, and cpan > only has a procfs module defined for Solaris. So > the question remains, after > choosing loghandler as the way to write to the log, > how to get the memory > usage information? Is there a better way than ps in > backticks? > Proc::ProcessTable > might be the thing -- it appears to reimplement ps > with the output as > a perl data > structure rather than linefeed-separated records. > There is also Unix::Process, > but that is merely a wrapper for ps in backticks. > - Igor __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com