| 1 | package System::Info::HPUX; | ||||||||||||||||||||||||||||
| 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.051"; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | System::Info::HPUX - Object for specific HP-UX 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=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 24 | 0 | $self->SUPER::prepare_sysinfo; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | $self->{__os} =~ s/hp-ux/HP-UX/; | |||||||||||||||||||||||||||
| 27 | 0 | chomp (my $k64 = `/usr/bin/getconf KERNEL_BITS 2>/dev/null`); | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | length $k64 and $self->{__os} .= "/$k64"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # ioscan is always available | ||||||||||||||||||||||||||||
| 31 | 0 | $self->{__cpu_count} = grep m/^processor/ => `/usr/sbin/ioscan -knfCprocessor`; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | $self->_prepare_cpu_type; | |||||||||||||||||||||||||||
| 34 | 0 | return $self; | |||||||||||||||||||||||||||
| 35 | } # prepare_sysinfo | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub _prepare_cpu_type { | ||||||||||||||||||||||||||
|
Subroutine
_prepare_cpu_type: not called CC=28 SCAR=67.0
| |||||||||||||||||||||||||||||
| 38 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | my $parisc = 0; | |||||||||||||||||||||||||||
| 41 | # For now, unknown cpu_types are set as the Generic | ||||||||||||||||||||||||||||
| 42 | 0 | chomp (my $cv = `/usr/bin/getconf CPU_VERSION 2>/dev/null`); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | # see /usr/include/sys/unistd.h for hex values | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ($cv < 0x20B) { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 46 | # $self->{__cpu_type} = sprintf("Unknown CPU_VERSION 0x%x", $cv); | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | ▶ | elsif ($cv >= 0x20C && $cv <= 0x20E) { | |||||||||||||||||||||||||||
|
Condition0%0/3
$cv >= 524 and $cv <= 526
MC/DC0%0/2
$cv >= 524 and $cv <= 526
$cv >= 524
$cv <= 526
Truth table0%0/3
A and B
A= $cv >= 524B= $cv <= 526
| |||||||||||||||||||||||||||||
| 49 | 0 | $self->{__cpu_type} = "Motorola"; # You have an antique | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | elsif ($cv <= 0x2FF) { | ||||||||||||||||||||||||||||
| 52 | 0 | $self->{__cpu_type} = "PA-RISC"; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | $self->{__cpu_type} = "PA-RISC1.0" if $cv == 0x20B; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | ▶ | $self->{__cpu_type} = "PA-RISC1.1" if $cv == 0x210; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $self->{__cpu_type} = "PA-RISC1.2" if $cv == 0x211; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | $self->{__cpu_type} = "PA-RISC2.0" if $cv == 0x214; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | $parisc++; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | elsif ($cv == 0x300) { | ||||||||||||||||||||||||||||
| 60 | 0 | $self->{__cpu_type} = "ia64"; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | else { | ||||||||||||||||||||||||||||
| 63 | # $self->{__cpu_type} = sprintf("Unknown CPU_VERSION 0x%x", $cv); | ||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ($parisc) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | my (@cpu, $lst); | |||||||||||||||||||||||||||
| 67 | 0 | chomp (my $model = `model`); | |||||||||||||||||||||||||||
| 68 | 0 | (my $m = $model) =~ s{.*/}{}; | |||||||||||||||||||||||||||
| 69 | 0 | foreach my $f (qw( /usr/sam/lib/mo/sched.models | |||||||||||||||||||||||||||
| 70 | /opt/langtools/lib/sched.models )) { | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if (open my $fh, "<", $f) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | @cpu = grep m/$m/i => <$fh>; | |||||||||||||||||||||||||||
| 73 | 0 | close $fh; | |||||||||||||||||||||||||||
| 74 | 0 | ▶ | @cpu and last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if (@cpu == 0 && open my $lst, | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@cpu == 0 and open my $lst, "echo 'sc product cpu;il' | /usr/sbin/cstm |"
MC/DC0%0/2
@cpu == 0 and open my $lst, "echo 'sc product cpu;il' | /usr/sbin/cstm |"
@cpu == 0
open my $lst, "echo 'sc product cpu;il' | /usr/sbin/cstm |"
Truth table0%0/3
A and B
A= @cpu == 0B= open my $lst, "echo 'sc product cpu;il' | /usr/sbin/cstm |"
| |||||||||||||||||||||||||||||
| 78 | "echo 'sc product cpu;il' | /usr/sbin/cstm |") { | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | while (<$lst>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | s/^\s*(PA)\s*(\d+)\s+CPU Module.*/$m 1.1 $1$2/ or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $2 =~ m/^8/ and s/ 1.1 / 2.0 /; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 0 | push @cpu, $_; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if (@cpu and $cpu[0] =~ m/^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@cpu and $cpu[0] =~ /^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/
MC/DC0%0/2
@cpu and $cpu[0] =~ /^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/
@cpu
$cpu[0] =~ /^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/
Truth table0%0/3
A and B
A= @cpuB= $cpu[0] =~ /^\S+\s+(\d+\.\d+[a-z]?)\s+(\S+)/
| |||||||||||||||||||||||||||||
| 86 | 0 | my ($arch, $cpu) = ("PA-RISC$1", $2); | |||||||||||||||||||||||||||
| 87 | 0 | $self->{__cpu} = $cpu; | |||||||||||||||||||||||||||
| 88 | 0 | chomp (my $hw3264 = | |||||||||||||||||||||||||||
| 89 | `/usr/bin/getconf HW_32_64_CAPABLE 2>/dev/null`); | ||||||||||||||||||||||||||||
| 90 | 0 | (my $osvers = $self->{__os}) =~ s/.*[AB]\.//; | |||||||||||||||||||||||||||
| 91 | 0 | $osvers =~ s{/.*}{}; | |||||||||||||||||||||||||||
| 92 | 0 | ▶ | $osvers <= 10.20 and $hw3264 = 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ($hw3264 == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 94 | 0 | $self->{__cpu_type} = $arch . "/64"; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | elsif ($hw3264 == 0) { | ||||||||||||||||||||||||||||
| 97 | 0 | $self->{__cpu_type} = $arch . "/32"; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||
| 102 | 0 | my $machinfo = `/usr/contrib/bin/machinfo`; | |||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($machinfo =~ m/processor model:\s+(\d+)\s+(.*)/) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 104 | 0 | $self->{__cpu} = $2; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | elsif ($machinfo =~ m{\s*[0-9]+\s+(intel.r.*processor)\s*\(([0-9.]+)\s*([GM])Hz.*}mi) { | ||||||||||||||||||||||||||||
| 107 | 0 | my ($m, $s, $h) = ($1, $2, $3); | |||||||||||||||||||||||||||
| 108 | 0 | $m =~ s{ series processor}{}; | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | $h eq "G" and $s = int ($s * 1024); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | $self->{__cpu} = "$m/$s"; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | $machinfo =~ m/Clock\s+speed\s+=\s+(.*)/ and | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | $self->{__cpu} .= "/$1"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 0 | (my $v = $self->{__osvers}) =~ s/^[A-Z]+\.//; | |||||||||||||||||||||||||||
| 117 | 0 | $self->{__distro} = "HP-UX $v"; | |||||||||||||||||||||||||||
| 118 | } # _prepare_cpu_type | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 2 | 1; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | __END__ | ||||||||||||||||||||||||||||