Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call.


Linux-SysInfo documentation Contained in the Linux-SysInfo distribution.

Index


Code Index:

NAME

Top

Linux::SysInfo - Perl interface to the sysinfo(2) Linux system call.

VERSION

Top

Version 0.13

SYNOPSIS

Top

    use Linux::SysInfo qw/sysinfo/;

    my $si = sysinfo;
    print "$_: $si->{$_}\n" for keys %$si;

DESCRIPTION

Top

This module is a wrapper around the sysinfo(2) Linux system call. It gives information about the current uptime, load average, memory usage and processes running. Other systems have also this system call (e.g. Solaris), but in most cases the returned information is different.

CONSTANTS

Top

LS_HAS_EXTENDED

This constant is set to 1 if your kernel supports the three extended fields totalhigh, freehigh and mem_unit ; and to 0 otherwise.

FUNCTIONS

Top

sysinfo

This function takes no argument. It returns undef on failure or a hash reference whose keys are the members name of the struct sysinfo on success :

Prior to Linux 2.3.23 on i386 and 2.3.48 on all other architectures, the memory sizes were given in bytes. Since then, the following members are also available and all the memory sizes are given as multiples of mem_unit bytes :

EXPORT

Top

The only function of this module, sysinfo, and the constant LS_HAS_EXTENDED are only exported on request. Functions are also exported by the :funcs tag, and constants by :consts.

BINARY COMPATIBILITY

Top

If you upgrade your kernel to a greater version than 2.3.23 on i386 or 2.3.48 on any other platform, you will need to rebuild the module to access the extended fields.

Moreover, since the perl hash function has changed after the 5.6 version, you will also need to recompile the module if you upgrade your perl from a version earlier than 5.6.

DEPENDENCIES

Top

perl 5.6.

SEE ALSO

Top

The sysinfo(2) man page.

Sys::Info : Gather information about your system.

Sys::CpuLoad : Try several different methods to retrieve the load average.

BSD::getloadavg : Wrapper to the getloadavg(3) BSD system call.

AUTHOR

Top

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS

Top

Please report any bugs or feature requests to bug-linux-sysinfo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Linux-SysInfo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Linux::SysInfo

Tests code coverage report is available at http://www.profvince.com/perl/cover/Linux-SysInfo.

COPYRIGHT & LICENSE

Top


Linux-SysInfo documentation Contained in the Linux-SysInfo distribution.
package Linux::SysInfo;

use strict;
use warnings;

our $VERSION;
BEGIN {
 $VERSION = '0.13';
}

BEGIN {
 require XSLoader;
 XSLoader::load(__PACKAGE__, $VERSION);
}

use base qw/Exporter/;

our @EXPORT         = ();
our %EXPORT_TAGS    = (
 'funcs'  => [ qw/sysinfo/ ],
 'consts' => [ qw/LS_HAS_EXTENDED/ ]
);
our @EXPORT_OK      = map { @$_ } values %EXPORT_TAGS;
$EXPORT_TAGS{'all'} = [ @EXPORT_OK ];

1; # End of Linux::SysInfo