| 1 | package System::Info::Solaris; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use base "System::Info::Base"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = "0.050"; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | System::Info::Solaris - Object for specific Solaris/Sun-os info. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head2 $si->prepare_sysinfo | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Use os-specific tools to find out more about the system. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub prepare_sysinfo { | ||||||||||||||||||||||||||
|
Subroutine
prepare_sysinfo: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 24 | 0 | $self->SUPER::prepare_sysinfo; | |||||||||||||||||||||||||||
| 25 | 0 | $self->prepare_os; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | local $ENV{PATH} = "/usr/sbin:$ENV{PATH}"; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | my @psrinfo = `psrinfo -v`; | |||||||||||||||||||||||||||
| 30 | 0 | my ($psrinfo) = grep m/the .* operates .* [gm]hz/ix => @psrinfo; | |||||||||||||||||||||||||||
| 31 | 0 | my ($type, $speed, $magnitude) = | |||||||||||||||||||||||||||
| 32 | $psrinfo =~ m/the (.+) processor.*at (.+?)\s*([GM]hz)/i; | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $type =~ s/(v9)$/ $1 ? "64" : ""/e; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | my $cpu = $self->_cpu; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if (-d "/usr/platform") { # Solaris but not OSF/1. | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 38 | 0 | chomp (my $platform = `uname -i`); | |||||||||||||||||||||||||||
| 39 | 0 | my $pfpath = "/usr/platform/$platform/sbin/prtdiag"; | |||||||||||||||||||||||||||
| 40 | 0 | ▶ | if (-x "$pfpath") { # Not on Solaris-x86 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 0 | my $prtdiag = `$pfpath`; | |||||||||||||||||||||||||||
| 42 | 0 | ($cpu) = $prtdiag =~ m/^System .+\(([^\s\)]+)/; | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | unless ($cpu) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | my ($cpu_line) = grep m/\s+on-?line\s+/i => split /\n/ => $prtdiag; | |||||||||||||||||||||||||||
| 45 | 0 | ($cpu = (split " " => $cpu_line)[4]) =~ s/.*,//; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 0 | $cpu .= " ($speed$magnitude)"; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | else { | ||||||||||||||||||||||||||||
| 50 | 0 | $cpu .= " ($speed$magnitude)"; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | elsif (-x "/usr/sbin/sizer") { # OSF/1. | ||||||||||||||||||||||||||||
| 54 | 0 | $cpu = $type; | |||||||||||||||||||||||||||
| 55 | 0 | chomp ($type = `sizer -implver`); | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $ncpu = grep m/on-?line/ => `psrinfo`; | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | $self->{__cpu_type} = $type; | |||||||||||||||||||||||||||
| 61 | 0 | $self->{__cpu} = $cpu; | |||||||||||||||||||||||||||
| 62 | 0 | $self->{__cpu_count} = $ncpu; | |||||||||||||||||||||||||||
| 63 | 0 | return $self; | |||||||||||||||||||||||||||
| 64 | } # prepare_sysinfo | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head2 $si->prepare_os | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | Use os-specific tools to find out more about the operating system. | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =cut | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub prepare_os { | ||||||||||||||||||||||||||
|
Subroutine
prepare_os: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | my ($osn, $osv) = ($self->_osname, $self->_osvers); | |||||||||||||||||||||||||||
| 76 | 0 | ▶ | if ($^O =~ /solaris|sunos/i && $osv > 5) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$^O =~ /solaris|sunos/i and $osv > 5
MC/DC0%0/2
$^O =~ /solaris|sunos/i and $osv > 5
$^O =~ /solaris|sunos/i
$osv > 5
Truth table0%0/3
A and B
A= $^O =~ /solaris|sunos/iB= $osv > 5
| |||||||||||||||||||||||||||||
| 77 | 0 | $osn = "Solaris"; | |||||||||||||||||||||||||||
| 78 | 0 | $osv = "2." . (split m/\./ => $osv, 2)[1]; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | 0 | $self->{__os} = join " - ", $osn, $osv; | |||||||||||||||||||||||||||
| 81 | } # prepare_os | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 2 | 1; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | __END__ | ||||||||||||||||||||||||||||