The GTop module interfaces with the libgtop library.  The good news is
that there is a BSD version of libgtop.  See
http://home-of-linux.org/gnome/libgtop/platform-bsd.html for details.

Here is some example code:

<code>
#!/usr/bin/perl -w

use GTop;

use constant B  => 1;
use constant KB => B*1024;
use constant MB => KB*1024;

my $gtop = GTop->new;
my $mem  = $gtop->mem;
my $swp  = $gtop->swap;


write;


format STDOUT =

               MEMORY
Total           Used           Free
@<<<<<<<<<<<<<  @<<<<<<<<<<<<  @<<<<<<<<<<<<
$mem->total/MB, $mem->used/MB, $mem->free/MB

               SWAP
@<<<<<<<<<<<<<  @<<<<<<<<<<<<  @<<<<<<<<<<<<
$swp->total/MB, $swp->used/MB, $swp->free/MB

.
</code>

<output>

               MEMORY
Total           Used           Free
123.859375      101.29296875   22.56640625

               SWAP
250.9765625     37.1171875     213.859375

</output>

On 19 Jun 2001 12:44:17 -0400, Chris Hedemark wrote:
> Clarification:  I'm doing this on OpenBSD.  If there is a portable function
> that will work across *NIX flavors that is preferable but if not I guess I
> need something BSD specific.  Thanks.
> 
> Chris Hedemark - Hillsborough, NC
> http://yonderway.com
> ---- Original Message -----
> From: "Chris Hedemark" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 19, 2001 11:45 AM
> Subject: getting memory info from system
> 
> 
> > Howdy,
> >
> > I'm tearing through my O'Reilly books and the CPAN search trying to find a
> > module or built-in function call that will let me get statistics back from
> > the system regarding memory.  I'm trying to find:
> >
> > 1) real memory bytes total
> > 2) real memory bytes used
> > 3) real memory bytes free
> >
> > As a secondary interest I'd like to do the same stats but for the swap
> > file(s).
> >
> > Can anyone here point me in the right direction please?
> >
> > Thanks.
> >
> > Chris Hedemark - Hillsborough, NC
> > http://yonderway.com
> >
> >
> 
> 
> 
--
Today is Boomtime, the 26th day of Confusion in the YOLD 3167
Or not.


Reply via email to