The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Linux::Info::SysInfo - Collect linux system information.

VERSION

version 2.15

SYNOPSIS

    use Linux::Info::SysInfo;

    my $lxs  = Linux::Info::SysInfo->new;
    print $lxs->get_release(), "\n";

DESCRIPTION

Linux::Info::SysInfo gathers system information from the virtual /proc filesystem (procfs).

For more information read the documentation of the front-end module Linux::Info.

This class interface is incompatible with Sys::Statistics::Linux::SysInfo.

ATTRIBUTES

Generated by /proc/sys/kernel/{hostname,domainname,ostype,osrelease,version} and /proc/cpuinfo, /proc/meminfo, /proc/uptime, /proc/net/dev.

METHODS

new()

Call new() to create a new object.

    my $lxs = Linux::Info::SysInfo->new();

Without any parameters.

If you want to get uptime and idletime as raw value, then pass the following hash reference as parameter:

    my $lxs = Linux::Info::SysInfo->new({ raw_time => 1});

By default the raw_time attribute is false.

get_hostname

Returns the host name.

get_domain

Returns the host domain name.

get_kernel

Returns the kernel name (just a string).

See get_detailed_kernel for a instance of Linux::Info::KernelRelease or subclasses of it.

get_release

Returns the kernel release.

get_version

Returns the kernel version details.

get_mem

Returns the total size of memory.

get_swap

Returns the total size of swap space.

get_uptime

Returns the uptime of the system.

get_idletime

Returns the idle time of the system.

get_pcpucount

Returns the total number of physical CPUs.

get_tcpucount

Returns the total number of CPUs (cores, hyper threading).

get_interfaces

Returns the interfaces of the system.

get_arch

Returns the processor architecture (like uname -m).

has_multithread

Returns "true" (1) or "false" (0) indicating if the process has hyper threading enabled or not.

get_model

Returns the processor name and model.

get_raw_time

Returns "true" (1) or "false" (0) if the instance is enabled to present time attributes with their original (raw) format, or formatted ones.

is_multithread

A deprecated getter for the multithread attribute.

Use has_multithread method instead.

get_proc_arch

This method will return an integer as the architecture of the CPUs: 32 or 64 bits, depending on the flags retrieve for one CPU.

It is assumed that all CPUs will have the same flags, so this method will consider only the flags returned by the CPU with "core id" equal to 0 (in other words, the first CPU found).

get_cpu_flags

Returns an array reference with all flags retrieve from /proc/cpuinfo using the same logic described in get_proc_arch documentation.

get_model

A getter for the model attribute.

get_detailed_kernel

Returns an instance of Linux::Info::KernelRelease with all possible information that is available.

EXPORTS

Nothing.

KNOWN ISSUES

Linux running on ARM processors have a different interface on /proc/cpuinfo.

That means that the methods get_proc_arch and get_cpu_flags will not return their respective information. Tests for this module may fail as well.

SEE ALSO

AUTHOR

Alceu Rodrigues de Freitas Junior <glasswalk3r@yahoo.com.br>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Alceu Rodrigues de Freitas Junior.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007