System::Info(3pm)

System::Info3pm

Factory for system specific information objects

Usage

    use System::Info;
    my $si = System::Info->new;
    printf "Hostname:              %s\n", $si->host;
    printf "Number of CPU's:       %s\n", $si->ncpu;
    printf "Processor type:        %s\n", $si->cpu_type; # short
    printf "Processor description: %s\n", $si->cpu;      # long
    printf "OS and version:        %s\n", $si->os;

or

    use System::Info qw( sysinfo );
    printf "[%s]\n", sysinfo ();

or

    $ perl -MSystem::Info=si_uname -le print+si_uname

Overview

System::Info tries to present system-related information, like number of CPU's, architecture, OS and release related information in a system-independent way. This releases the user of this module of the need to know if the information comes from Windows, Linux, HP-UX, AIX, Solaris, Irix, or VMS, and if the architecture is i386, x64, pa-risc2, or arm.

Methods

System::Info->new

Factory method, with fallback to the information in "POSIX::uname ()".

sysinfo

"sysinfo" returns a string with "host", "os" and "cpu_type".

sysinfo_hash

"sysinfo_hash" returns a hash reference with basic system information, like:

  { cpu       => 'Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz (GenuineIntel 2700MHz)',
    cpu_count => '1 [8 cores]',
    cpu_cores => 8,
    cpu_type  => 'x86_64',
    distro    => 'openSUSE Tumbleweed 20171030',
    hostname  => 'foobar',
    os        => 'linux - 4.13.10-1-default [openSUSE Tumbleweed 20171030]',
    osname    => 'Linux',
    osvers    => '4.13.10-1-default'
    }

The "cpu_cores" count refers to logical cores. On MacOS there is also a "physical_cores" count, which will be the same as "cpu_cores" for Apple Silicon, but not for an Intel Mac with SMT enabled:

  { cpu            => 'Quad-Core Intel Core i7 (2 GHz)',
    cpu_count      => '1 [4 cores]',
    cpu_cores      => '8',
    physical_cores => '4',
    cpu_type       => 'x86_64',
    distro         => 'Darwin 11.7.10',
    hostname       => '192.168.1.6',
    os             => 'darwin - 20.6.0 (Mac OS X - macOS 11.7.10 (20G1427))',
    osname         => 'Darwin',
    osvers         => '11.7.10'
    }

si_uname (@args)

This class gathers most of the uname(1) info, make a comparable version. Takes almost the same arguments:

    a for all (can be omitted)
    n for nodename
    s for os name and version
    m for cpu name
    c for cpu count
    p for cpu_type

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

From libsystem-info-perl 0.066-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.