.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "System::Info 3pm" .TH System::Info 3pm "2020-12-22" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" System::Info \- Factory for system specific information objects .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use System::Info; \& \& my $si = System::Info\->new; \& \& printf "Hostname: %s\en", $si\->host; \& printf "Number of CPU\*(Aqs: %s\en", $si\->ncpu; \& printf "Processor type: %s\en", $si\->cpu_type; # short \& printf "Processor description: %s\en", $si\->cpu; # long \& printf "OS and version: %s\en", $si\->os; .Ve .PP or .PP .Vb 2 \& use System::Info qw( sysinfo ); \& printf "[%s]\en", sysinfo (); .Ve .PP or .PP .Vb 1 \& $ perl \-MSystem::Info=si_uname \-le print+si_uname .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" System::Info tries to present system-related information, like number of \s-1CPU\s0's, architecture, \s-1OS\s0 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, \s-1AIX,\s0 Solaris, Irix, or \s-1VMS,\s0 and if the architecture is i386, x64, pa\-risc2, or arm. .SH "METHODS" .IX Header "METHODS" .SS "System::Info\->new" .IX Subsection "System::Info->new" Factory method, with fallback to the information in \f(CW\*(C`POSIX::uname ()\*(C'\fR. .SS "sysinfo" .IX Subsection "sysinfo" \&\f(CW\*(C`sysinfo\*(C'\fR returns a string with \f(CW\*(C`host\*(C'\fR, \f(CW\*(C`os\*(C'\fR and \f(CW\*(C`cpu_type\*(C'\fR. .SS "sysinfo_hash" .IX Subsection "sysinfo_hash" \&\f(CW\*(C`sysinfo_hash\*(C'\fR returns a hash reference with basic system information, like: .PP .Vb 10 \& { cpu => \*(AqIntel(R) Core(TM) i7\-6820HQ CPU @ 2.70GHz (GenuineIntel 2700MHz)\*(Aq, \& cpu_count => \*(Aq1 [8 cores]\*(Aq, \& cpu_cores => 8, \& cpu_type => \*(Aqx86_64\*(Aq, \& distro => \*(AqopenSUSE Tumbleweed 20171030\*(Aq, \& hostname => \*(Aqfoobar\*(Aq, \& os => \*(Aqlinux \- 4.13.10\-1\-default [openSUSE Tumbleweed 20171030]\*(Aq, \& osname => \*(AqLinux\*(Aq, \& osvers => \*(Aq4.13.10\-1\-default\*(Aq \& } .Ve .SS "si_uname (@args)" .IX Subsection "si_uname (@args)" This class gathers most of the \f(CWuname(1)\fR info, make a comparable version. Takes almost the same arguments: .PP .Vb 6 \& 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 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" There are more modules that provide system and/or architectural information. .PP Where System::Info aims at returning the information that is useful for bug reports, some other modules focus on a single aspect (possibly with way more variables and methods than System::Info does supports), or are limited to use on a specific architecture, like Windows or Linux. .PP Here are some of the alternatives and how to replace that code with what System::Info offers. Not all returned values will be exactly the same. .SS "Sys::Hostname" .IX Subsection "Sys::Hostname" .Vb 2 \& use Sys::Hostname; \& say "Hostname: ", hostname; \& \& \-> \& \& use System::Info; \& my $si = System::Info\->new; \& say "Hostname: ", $si\->host; .Ve .PP Sys::Hostname is a \s-1CORE\s0 module, and will always be available. .SS "Unix::Processors" .IX Subsection "Unix::Processors" .Vb 6 \& use Unix::Processors; \& my $up = Unix::Processors\->new; \& say "CPU type : ", $up\->processors\->[0]\->type; \& say "CPU count: ", $up\->max_physical; \& say "CPU cores: ", $up\->max_online; \& say "CPU speed: ", $up\->max_clock; \& \& \-> \& \& use System::Info; \& my $si = System::Info\->new; \& say "CPU type : ", $si\->cpu; \& say "CPU count: ", $si\->ncpu; \& say "CPU cores: ", $si\->ncore; \& say "CPU speed: ", $si\->cpu =~ s{^.*\eb([0\-9.]+)\es*[A\-Z]Hz.*}{$1}r; .Ve .PP The number reported by max_physical is inaccurate for modern \s-1CPU\s0's .SS "Sys::Info" .IX Subsection "Sys::Info" Sys::Info has a somewhat rigid configuration, which causes it to fail installation on e.g. (modern versions of) CentOS and openSUSE Tumbleweed. .PP It aims at returning a complete set of information, but as I cannot install it on openSUSE Tumbleweed, I cannot test it and show the analogies. .SS "Sys::CPU" .IX Subsection "Sys::CPU" .Vb 4 \& use Sys::CPU; \& say "CPU type : ", Sys::CPU::cpu_type (); \& say "CPU count: ", Sys::CPU::cpu_count (); \& say "CPU speed: ", Sys::CPU::cpu_clock (); \& \& \-> \& \& use System::Info; \& my $si = System::Info\->new; \& say "CPU type : ", $si\->get_cpu; # or \->cpu \& say "CPU count: ", $si\->get_core_count; # or \->ncore \& say "CPU speed: ", $si\->get_cpu =~ s{^.*\eb([0\-9.]+)\es*[A\-Z]Hz.*}{$1}r; .Ve .PP The speed reported by Sys::CPU is the \fIcurrent\fR speed, and it will change from call to call. \s-1YMMV.\s0 .PP Sys::CPU is not available on \s-1CPAN\s0 anymore, but you can still get is from BackPAN. .SS "Devel::Platform::Info" .IX Subsection "Devel::Platform::Info" Devel::Platform::Info derives information from the files \f(CW\*(C`/etc/issue\*(C'\fR, \&\f(CW\*(C`/etc/.issue\*(C'\fR and the output of the commands \f(CW\*(C`uname \-a\*(C'\fR (and \f(CW\*(C`\-m\*(C'\fR, \f(CW\*(C`\-o\*(C'\fR, \&\f(CW\*(C`\-r\*(C'\fR, and \f(CW\*(C`\-s\*(C'\fR) and \f(CW\*(C`lsb_release \-a\*(C'\fR. It returns no information on \s-1CPU\s0 type, \s-1CPU\s0 speed, or Memory. .PP .Vb 2 \& use Devel::Platform::Info; \& my $info = Devel::Platform::Info\->new\->get_info (); \& \& \-> \& \& use System::Info; \& my $si = System::Info\->new; \& my $info = { \& archname => $si\->cpu_type, \& codename => undef, \& is32bit => undef, \& is64bit => undef, \& kernel => "$^O\-".$si\->_osvers, \& kname => $si\->_osname, \& kvers => $si\->_osvers, \& osflag => $^O, \& oslabel => $si\->distro, \& osname => undef, \& osvers => $si\->distro, \& }; .Ve .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" (c) 2016\-2020, Abe Timmerman & H.Merijn Brand, All rights reserved. .PP With contributions from Jarkko Hietaniemi, Campo Weijerman, Alan Burlison, Allen Smith, Alain Barbet, Dominic Dunlop, Rich Rauenzahn, David Cantrell. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP See: .IP "\(bu" 4 .IP "\(bu" 4 .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0