diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/CPU.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/CPU.pm index b4f6e59300..1fb744a4e2 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/CPU.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Solaris/CPU.pm @@ -9,7 +9,7 @@ use FusionInventory::Agent::Tools; use FusionInventory::Agent::Tools::Solaris; sub isEnabled { - return canRun('memconf'); + return 1; } sub doInventory { @@ -18,193 +18,128 @@ sub doInventory { my $inventory = $params{inventory}; my $logger = $params{logger}; - my $class = getClass(); - - my ($count, $cpu) = - $class == SOLARIS_CONTAINER ? - _getCPUFromPrtcl(logger => $logger) : - _getCPUFromMemconf(logger => $logger); - - # fallback on generic method - ($count, $cpu) = _getCPUFromPsrinfo(logger => $logger) if !$count; + # get virtual cpus from psrinfo -v + my @vcpus = _getVirtualCPUs(logger => $logger); + + # get physical cpus from psrinfo -vp + my @pcpus = _getPhysicalCPUs(logger => $logger); + + # consider all cpus as identical + my $type = $pcpus[0]->{type} || $vcpus[0]->{type}; + my $speed = $pcpus[0]->{speed} || $vcpus[0]->{speed}; + my $manufacturer = + $type =~ /SPARC/ ? 'SPARC' : + $type =~ /Xeon/ ? 'Intel' : + undef ; + my $cpus = scalar @pcpus; + + my ($cores, $threads) = + $type eq 'UltraSPARC-IV' ? (2, 1) : # US-IV & US-IV+ + $type eq 'UltraSPARC-T1' ? (undef, 4) : # Niagara + $type eq 'UltraSPARC-T2' ? (undef, 8) : # Niagara-II + $type eq 'UltraSPARC-T2+' ? (undef, 8) : # Victoria Falls + $type eq 'SPARC-T3' ? (undef, 8) : # Rainbow Falls + $type eq 'SPARC64-VI' ? (2, 2) : # Olympus-C SPARC64-VI + $type eq 'SPARC64-VII' ? (4, 2) : # Jupiter SPARC64-VII + $type eq 'SPARC64-VII+' ? (4, 2) : # Jupiter+ SPARC64-VII+ + $type eq 'SPARC64-VII++' ? (4, 2) : # Jupiter++ SPARC64-VII++ + $type eq 'SPARC64-VIII' ? (8, 2) : # Venus SPARC64-VIII + (1, 1) ; + + if ($type =~ /MB86907/) { + $type = "TurboSPARC-II $type"; + } elsif ($type =~ /MB86904|390S10/) { + $type = ($speed > 70) ? "microSPARC-II $type" : "microSPARC $type"; + } elsif ($type =~ /,RT62[56]/) { + $type = "hyperSPARC $type"; + } - $cpu->{MANUFACTURER} = "SPARC"; + # deduce core numbers from number of virtual cpus if needed + if (!$cores) { + # todo: solaris zone + $cores = (scalar @vcpus) / $threads / $cpus; + } - while ($count--) { + while ($cpus--) { $inventory->addEntry( section => 'CPUS', - entry => $cpu + entry => { + MANUFACTURER => $manufacturer, + NAME => $type, + SPEED => $speed, + CORE => $cores, + THREAD => $threads + } ); } } - -# Sun Microsystems, Inc. Sun Fire 880 (4 X UltraSPARC-III 750MHz) -# Sun Microsystems, Inc. Sun Fire V490 (2 X dual-thread UltraSPARC-IV 1350MHz) -# Sun Microsystems, Inc. Sun Fire V240 (UltraSPARC-IIIi 1002MHz) -# Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (8-core quad-thread UltraSPARC-T1 1000MHz) -# Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (4-core quad-thread UltraSPARC-T1 1000MHz) -# Sun Microsystems, Inc. SPARC Enterprise T5120 (8-core 8-thread UltraSPARC-T2 1165MHz) -# Sun Microsystems, Inc. SPARC Enterprise T5120 (4-core 8-thread UltraSPARC-T2 1165MHz) -# Sun Microsystems, Inc. Sun SPARC Enterprise M5000 Server (6 X dual-core dual-thread SPARC64-VI 2150MHz) -# Fujitsu SPARC Enterprise M4000 Server (4 X dual-core dual-thread SPARC64-VI 2150MHz) -# Sun Microsystems, Inc. Sun Fire V20z (Solaris x86 machine) (2 X Dual Core AMD Opteron(tm) Processor 270 1993MHz) - -sub _getCPUFromMemconf { - my $spec = getFirstMatch( - command => 'memconf', - pattern => qr/^((?:Sun|Fujitsu|Intel) .* \d+ [GM]Hz\))/x, - @_ - ); - return _parseSpec($spec); -} - -sub _parseCoreString { - my ($v) = @_; - - return - $v =~ /dual/i ? 2 : - $v =~ /quad/i ? 4 : - $v =~ /(\d+)-\w+/ ? $1 : - $v; -} - -sub _parseSpec { - my ($spec) = @_; - - my $manufacturer; - if ($spec =~ /(AMD|Fujitsu|Intel)\s/g) { - $manufacturer = $1; - } elsif ($spec =~ /Sun/) { - $manufacturer = 'Sun Microsystems'; - } - - # 4 X UltraSPARC-III 750MHz - if ($spec =~ /(\d+) \s X \s (\S+) \s (\d+ \s* .Hz)/x) { - return $1, { - MANUFACTURER => $manufacturer, - NAME => $2, - SPEED => getCanonicalSpeed($3), - CORE => 1, - }; - } - - # 2 X dual-thread UltraSPARC-IV 1350MHz - if ($spec =~ /(\d+) \s X \s (\S+) \s (\S+) \s (\d+) MHz/x) { - return $1, { - MANUFACTURER => $manufacturer, - NAME => $3 . " (" . $2 . ")", - SPEED => $4, - CORE => _parseCoreString($1), - THREAD => _parseCoreString($2) - }; - } - - # 8-core quad-thread UltraSPARC-T1 1000MHz - # 8-core 8-thread UltraSPARC-T2 1165MHz - # 16-Core 8-Thread SPARC-T3 1649MHz - if ($spec =~ /(\d+ -[cC]ore) \s (\S+) \s (\S+) \s (\d+) MHz/x) { - return 1, { - MANUFACTURER => $manufacturer, - NAME => $3 . " (" . $1 . " " . $2 . ")", - SPEED => $4, - CORE => _parseCoreString($1), - THREAD => _parseCoreString($2) - }; - } - - # 6 X dual-core dual-thread SPARC64-VI 2150MHz - if ($spec =~ /(\d+) \s X \s (\S+) \s (\S+) \s (\S+) \s (\d+) MHz/x) { - return $1, { - MANUFACTURER => $manufacturer, - NAME => $4 . " (" . $2 . " " . $3 . ")", - SPEED => $5, - CORE => _parseCoreString($2), - THREAD => _parseCoreString($3) - }; - } - - # 2 X Dual Core AMD Opteron(tm) Processor 270 1993MHz - if ($spec =~ /(\d+) \s X \s (\S+) \s Core \s AMD \s (Opteron\(tm\) \s Processor \s \S+) \s ([\.\d]+ \s* .Hz)/x) { - return $1, { - MANUFACTURER => $manufacturer, - NAME => $3, - SPEED => getCanonicalSpeed($4), - CORE => _parseCoreString($2), - }; - } - - # 2 X Quad-Core Intel(R) Xeon(R) E7320 @ 2.13GHz - if ($spec =~ /(\d+) \s X \s (\S+) \s Intel\(R\) \s (Xeon\(R\) \s E\d+) \s @ \s ([\d\.]+\s*.Hz)/x) { - return $1, { - MANUFACTURER => $manufacturer, - NAME => $3, - SPEED => getCanonicalSpeed($4), - CORE => _parseCoreString($2), - }; - } - - # UltraSPARC-IIi 270MHz - # UltraSPARC-III 750MHz - if ($spec =~ /([^()\s]\S+) \s (\d+ \s* .Hz)/x) { - return 1, { - MANUFACTURER => $manufacturer, - NAME => $1, - SPEED => getCanonicalSpeed($2), - CORE => 1, - }; - } - -} - -sub _getCPUFromPsrinfo { - my (%params) = ( - command => 'psrinfo -v', +sub _getVirtualCPUs { + my %params = ( + command => '/usr/sbin/psrinfo -v', @_ ); my $handle = getFileHandle(%params); return unless $handle; - my $count = 0; - my $cpu; + my @cpus; while (my $line = <$handle>) { - next unless $line =~ - /^\s+The\s(\w+)\sprocessor\soperates\sat\s(\d+)\sMHz,/; - - $cpu->{NAME} = $1; - $cpu->{SPEED} = $2; - $count++; + if ($line =~ /The (\S+) processor operates at (\d+) MHz/) { + push @cpus, { + type => $1, + speed => $2, + }; + next; + } } close $handle; - return ($count, $cpu); + return @cpus; } -sub _getCPUFromPrtcl { - my (%params) = ( - command => "prctl -n zone.cpu-shares $PID", +sub _getPhysicalCPUs { + my %params = ( + command => '/usr/sbin/psrinfo -vp', @_ ); my $handle = getFileHandle(%params); return unless $handle; - my ($count, $cpu); + my @cpus; while (my $line = <$handle>) { - $cpu->{NAME} = $1 if $line =~ /^zone.(\S+)$/; - $cpu->{NAME} .= " " . $1 if $line =~ /^\s*privileged+\s*(\d+)/; - #$count = 1 if /^\s*privileged+\s*(\d+)/; - foreach (`memconf 2>&1`) { - if(/\s+\((\d+).*\s+(\d+)MHz/) { - $count = $1; - $cpu->{SPEED} = $2; - } + + if ($line =~ /^The physical processor has (\d+) virtual/) { + push @cpus, { + count => $1 + }; + next; + } + + if ($line =~ /^The (\S+) physical processor has (\d+) virtual/) { + push @cpus, { + type => $1, + count => $2 + }; + next; + } + + if ($line =~ /(\S+) \(.* clock (\d+) MHz\)/) { + my $cpu = $cpus[-1]; + $cpu->{type} = $1; + $cpu->{speed} = $2; + next; + } + + if ($line =~ /Intel\(r\) Xeon\(r\) CPU +(\S+)/) { + my $cpu = $cpus[-1]; + $cpu->{type} = "Xeon $1"; } } close $handle; - return ($count, $cpu); + return @cpus; } 1; diff --git a/resources/solaris/psrinfo/giration-psrinfo_v b/resources/solaris/psrinfo/giration-psrinfo_v new file mode 100644 index 0000000000..009f0bd1ad --- /dev/null +++ b/resources/solaris/psrinfo/giration-psrinfo_v @@ -0,0 +1,64 @@ +Status of virtual processor 0 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 1 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 2 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 3 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 4 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 5 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 6 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 7 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:01. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 16 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 17 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 18 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 19 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 20 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 21 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 22 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 23 as of: 08/13/2012 19:19:39 + on-line since 08/03/2012 16:48:05. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. diff --git a/resources/solaris/psrinfo/giration-psrinfo_vp b/resources/solaris/psrinfo/giration-psrinfo_vp new file mode 100644 index 0000000000..e9ca01e184 --- /dev/null +++ b/resources/solaris/psrinfo/giration-psrinfo_vp @@ -0,0 +1,16 @@ +The physical processor has 2 virtual processors (0 16) + UltraSPARC-IV (portid 0 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (1 17) + UltraSPARC-IV (portid 1 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (2 18) + UltraSPARC-IV (portid 2 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (3 19) + UltraSPARC-IV (portid 3 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (4 20) + UltraSPARC-IV (portid 4 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (5 21) + UltraSPARC-IV (portid 5 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (6 22) + UltraSPARC-IV (portid 6 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (7 23) + UltraSPARC-IV (portid 7 impl 0x18 ver 0x31 clock 1350 MHz) diff --git a/resources/solaris/psrinfo/sample1 b/resources/solaris/psrinfo/sample1-psrinfo_v similarity index 100% rename from resources/solaris/psrinfo/sample1 rename to resources/solaris/psrinfo/sample1-psrinfo_v diff --git a/resources/solaris/psrinfo/t5120-psrinfo_v b/resources/solaris/psrinfo/t5120-psrinfo_v new file mode 100644 index 0000000000..c189a5f341 --- /dev/null +++ b/resources/solaris/psrinfo/t5120-psrinfo_v @@ -0,0 +1,128 @@ +Status of virtual processor 0 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:09. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 1 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 2 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 3 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 4 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 5 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 6 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 7 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 8 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 9 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 10 as of: 09/05/2012 09:37:05 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 11 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 12 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 13 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 14 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 15 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 16 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 17 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 18 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 19 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 20 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 21 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 22 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 23 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 24 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 25 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 26 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 27 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 28 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 29 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 30 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 31 as of: 09/05/2012 09:37:06 + on-line since 06/25/2012 11:58:10. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. diff --git a/resources/solaris/psrinfo/t5120-psrinfo_vp b/resources/solaris/psrinfo/t5120-psrinfo_vp new file mode 100644 index 0000000000..455d1bb794 --- /dev/null +++ b/resources/solaris/psrinfo/t5120-psrinfo_vp @@ -0,0 +1,2 @@ +The physical processor has 32 virtual processors (0-31) + UltraSPARC-T2 (chipid 0, clock 1165 MHz) diff --git a/resources/solaris/psrinfo/unstable11s-psrinfo_v b/resources/solaris/psrinfo/unstable11s-psrinfo_v new file mode 100644 index 0000000000..d86329b4c1 --- /dev/null +++ b/resources/solaris/psrinfo/unstable11s-psrinfo_v @@ -0,0 +1,16 @@ +Status of virtual processor 0 as of: 09/04/2012 23:07:48 + on-line since 05/31/2012 11:32:59. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 1 as of: 09/04/2012 23:07:48 + on-line since 05/31/2012 11:33:00. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 2 as of: 09/04/2012 23:07:48 + on-line since 05/31/2012 11:33:00. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 3 as of: 09/04/2012 23:07:48 + on-line since 05/31/2012 11:33:00. + The sparcv9 processor operates at 1165 MHz, + and has a sparcv9 floating point processor. diff --git a/resources/solaris/psrinfo/unstable11s-psrinfo_vp b/resources/solaris/psrinfo/unstable11s-psrinfo_vp new file mode 100644 index 0000000000..ba40380a51 --- /dev/null +++ b/resources/solaris/psrinfo/unstable11s-psrinfo_vp @@ -0,0 +1,3 @@ +The physical processor has 4 virtual processors (0-3) + UltraSPARC-T2 (chipid 0, clock 1165 MHz) + diff --git a/resources/solaris/psrinfo/unstable11x-psrinfo_v b/resources/solaris/psrinfo/unstable11x-psrinfo_v new file mode 100644 index 0000000000..01d6cda2d3 --- /dev/null +++ b/resources/solaris/psrinfo/unstable11x-psrinfo_v @@ -0,0 +1,16 @@ +Status of virtual processor 0 as of: 09/04/2012 23:25:04 + on-line since 05/31/2012 11:23:12. + The i386 processor operates at 2326 MHz, + and has an i387 compatible floating point processor. +Status of virtual processor 1 as of: 09/04/2012 23:25:04 + on-line since 05/31/2012 11:23:13. + The i386 processor operates at 2326 MHz, + and has an i387 compatible floating point processor. +Status of virtual processor 2 as of: 09/04/2012 23:25:04 + on-line since 05/31/2012 11:23:13. + The i386 processor operates at 2326 MHz, + and has an i387 compatible floating point processor. +Status of virtual processor 3 as of: 09/04/2012 23:25:04 + on-line since 05/31/2012 11:23:14. + The i386 processor operates at 2326 MHz, + and has an i387 compatible floating point processor. diff --git a/resources/solaris/psrinfo/unstable11x-psrinfo_vp b/resources/solaris/psrinfo/unstable11x-psrinfo_vp new file mode 100644 index 0000000000..128188a3fe --- /dev/null +++ b/resources/solaris/psrinfo/unstable11x-psrinfo_vp @@ -0,0 +1,12 @@ +The physical processor has 1 virtual processor (0) + x86 (GenuineIntel 10676 family 6 model 23 step 6 clock 2326 MHz) + Intel(r) Xeon(r) CPU E5410 @ 2.33GHz +The physical processor has 1 virtual processor (1) + x86 (GenuineIntel 10676 family 6 model 23 step 6 clock 2326 MHz) + Intel(r) Xeon(r) CPU E5410 @ 2.33GHz +The physical processor has 1 virtual processor (2) + x86 (GenuineIntel 10676 family 6 model 23 step 6 clock 2326 MHz) + Intel(r) Xeon(r) CPU E5410 @ 2.33GHz +The physical processor has 1 virtual processor (3) + x86 (GenuineIntel 10676 family 6 model 23 step 6 clock 2326 MHz) + Intel(r) Xeon(r) CPU E5410 @ 2.33GHz diff --git a/resources/solaris/psrinfo/v240-psrinfo_v b/resources/solaris/psrinfo/v240-psrinfo_v new file mode 100644 index 0000000000..76f47eefcb --- /dev/null +++ b/resources/solaris/psrinfo/v240-psrinfo_v @@ -0,0 +1,8 @@ +Status of virtual processor 0 as of: 09/05/12 09:36:17 + on-line since 08/21/12 14:58:19. + The sparcv9 processor operates at 1280 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 1 as of: 09/05/12 09:36:17 + on-line since 08/21/12 14:58:18. + The sparcv9 processor operates at 1280 MHz, + and has a sparcv9 floating point processor. diff --git a/resources/solaris/psrinfo/v240-psrinfo_vp b/resources/solaris/psrinfo/v240-psrinfo_vp new file mode 100644 index 0000000000..bd147b61b2 --- /dev/null +++ b/resources/solaris/psrinfo/v240-psrinfo_vp @@ -0,0 +1,2 @@ +The UltraSPARC-IIIi physical processor has 1 virtual processor (0) +The UltraSPARC-IIIi physical processor has 1 virtual processor (1) diff --git a/resources/solaris/psrinfo/v490-psrinfo_v b/resources/solaris/psrinfo/v490-psrinfo_v new file mode 100644 index 0000000000..994464901b --- /dev/null +++ b/resources/solaris/psrinfo/v490-psrinfo_v @@ -0,0 +1,32 @@ +Status of virtual processor 0 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 1 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 2 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 3 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:42. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 16 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 17 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 18 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. +Status of virtual processor 19 as of: 09/05/2012 09:40:11 + on-line since 09/03/2012 18:10:43. + The sparcv9 processor operates at 1350 MHz, + and has a sparcv9 floating point processor. diff --git a/resources/solaris/psrinfo/v490-psrinfo_vp b/resources/solaris/psrinfo/v490-psrinfo_vp new file mode 100644 index 0000000000..539967a24b --- /dev/null +++ b/resources/solaris/psrinfo/v490-psrinfo_vp @@ -0,0 +1,8 @@ +The physical processor has 2 virtual processors (0 16) + UltraSPARC-IV (portid 0 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (1 17) + UltraSPARC-IV (portid 1 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (2 18) + UltraSPARC-IV (portid 2 impl 0x18 ver 0x31 clock 1350 MHz) +The physical processor has 2 virtual processors (3 19) + UltraSPARC-IV (portid 3 impl 0x18 ver 0x31 clock 1350 MHz) diff --git a/t/inventory/solaris/cpu.t b/t/inventory/solaris/cpu.t index 27d9f8e6a1..89ed3b7aa1 100755 --- a/t/inventory/solaris/cpu.t +++ b/t/inventory/solaris/cpu.t @@ -7,175 +7,76 @@ use Test::More; use FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU; -my %memconf_tests = ( - sample4 => [ - 2, - { - NAME => 'Opteron(tm) Processor 270', - MANUFACTURER => 'AMD', - SPEED => '1993', - CORE => '2' - }, - ], - sample3 => [ - 1, - { - NAME => 'SPARC-T3 (16-Core 8-Thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1649', - CORE => '16', - THREAD => '8' - }, - ], - sample2 => [ - 1, - { - NAME => 'UltraSPARC-IIi', - MANUFACTURER => 'Sun Microsystems', - SPEED => '270', - CORE => '1' - }, - ], - sample1 => [ - 2, - { - NAME => 'Xeon(R) E7320', - MANUFACTURER => 'Intel', - SPEED => '2130', - CORE => '4' - }, - ] -); - -my %psrinfo_tests = ( - sample1 => [ - 8, - { - NAME => 'i386', - SPEED => 2133 - } - ] +my %vpcu_tests = ( + unstable9s => [ 24, { speed => '1165', type => 'sparcv9' } ], + unstable9x => [ 4, { speed => '2333', type => 'i386' } ], + unstable10s => [ 24, { speed => '1165', type => 'sparcv9' } ], + unstable10x => [ 4, { speed => '2333', type => 'i386' } ], + unstable11s => [ 4, { speed => '1165', type => 'sparcv9' } ], + unstable11x => [ 4, { speed => '2326', type => 'i386' } ], + giration => [ 16, { speed => '1350', type => 'sparcv9' } ], + v240 => [ 2, { speed => '1280', type => 'sparcv9' } ], + v490 => [ 8, { speed => '1350', type => 'sparcv9' } ], + t5120 => [ 32, { speed => '1165', type => 'sparcv9' } ], ); -my %spec_tests = ( - 'Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (8-core quad-thread UltraSPARC-T1 1000MHz)' => [ +my %pcpu_tests = ( + unstable9s => [ 1, - { - NAME => 'UltraSPARC-T1 (8-core quad-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1000', - THREAD => '4', - CORE => '8' - } + { speed => '1165', type => 'UltraSPARC-T2', count => 24 } ], - 'Sun Microsystems, Inc. Sun Fire 880 (4 X UltraSPARC-III 750MHz)' => [ + unstable9x => [ 4, - { - NAME => 'UltraSPARC-III', - MANUFACTURER => 'Sun Microsystems', - SPEED => '750', - CORE => '1' - } + { type => 'i386', count => 1 } ], - 'Sun Microsystems, Inc. SPARC Enterprise T5120 (8-core 8-thread UltraSPARC-T2 1165MHz)' => [ + unstable10s => [ 1, - { - NAME => 'UltraSPARC-T2 (8-core 8-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1165', - THREAD => '8', - CORE => '8' - } + { speed => '1165', type => 'UltraSPARC-T2', count => 24 } ], - 'Sun Microsystems, Inc. Sun Fire V240 (UltraSPARC-IIIi 1002MHz)' => [ + unstable10x => [ + 4, + { speed => '2333', type => 'Xeon E5410', count => 1 } + ], + unstable11s => [ 1, - { - NAME => 'UltraSPARC-IIIi', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1002', - CORE => '1' - } + { speed => '1165', type => 'UltraSPARC-T2', count => 4 } ], - 'Sun Microsystems, Inc. Sun SPARC Enterprise M5000 Server (6 X dual-core dual-thread SPARC64-VI 2150MHz)' => [ - 6, - { - NAME => 'SPARC64-VI (dual-core dual-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '2150', - THREAD => '2', - CORE => '2' - } + unstable11x => [ + 4, + { speed => '2326', type => 'Xeon E5410', count => 1 } ], - 'Sun Microsystems, Inc. Sun Fire V490 (2 X dual-thread UltraSPARC-IV 1350MHz)' => [ - 2, - { - NAME => 'UltraSPARC-IV (dual-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1350', - THREAD => '2', - CORE => '2' - } + giration => [ + 8, + { speed => '1350', type => 'UltraSPARC-IV', count => 2 } ], - 'Sun Microsystems, Inc. Sun Fire V20z (Solaris x86 machine) (2 X Dual Core AMD Opteron(tm) Processor 270 1993MHz)' => [ - '2', - { - NAME => 'Opteron(tm) Processor 270', - MANUFACTURER => 'AMD', - SPEED => '1993', - CORE => '2' - } + v240 => [ + 2, + { type => 'UltraSPARC-IIIi', count => 1 } ], - 'Fujitsu SPARC Enterprise M4000 Server (4 X dual-core dual-thread SPARC64-VI 2150MHz)' => [ - '4', - { - NAME => 'SPARC64-VI (dual-core dual-thread)', - MANUFACTURER => 'Fujitsu', - SPEED => '2150', - THREAD => '2', - CORE => '2' - } + v490 => [ + 4, + { speed => '1350', type => 'UltraSPARC-IV', count => 2 } ], - 'Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (4-core quad-thread UltraSPARC-T1 1000MHz)' - => [ + t5120 => [ 1, - { - NAME => 'UltraSPARC-T1 (4-core quad-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1000', - THREAD => '4', - CORE => '4' - } + { speed => '1165', type => 'UltraSPARC-T2', count => 32 } ], - 'Sun Microsystems, Inc. SPARC Enterprise T5120 (4-core 8-thread UltraSPARC-T2 1165MHz)' => [ - 1, - { - NAME => 'UltraSPARC-T2 (4-core 8-thread)', - MANUFACTURER => 'Sun Microsystems', - SPEED => '1165', - THREAD => '8', - CORE => '4' - } - ] ); plan tests => - (scalar keys %memconf_tests) + - (scalar keys %psrinfo_tests) + - (scalar keys %spec_tests) ; - -foreach my $test (keys %memconf_tests) { - my $file = "resources/solaris/memconf/$test"; - my @results = FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU::_getCPUFromMemconf(file => $file); - is_deeply(\@results, $memconf_tests{$test}, "memconf parsing: $test" ); -} + 2 * (scalar keys %vpcu_tests) + + 2 * (scalar keys %pcpu_tests) ; -foreach my $test (keys %psrinfo_tests) { - my $file = "resources/solaris/psrinfo/$test"; - my @results = FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU::_getCPUFromPsrinfo(file => $file); - is_deeply(\@results, $psrinfo_tests{$test}, "psrinfo parsing: $test" ); +foreach my $test (keys %vpcu_tests) { + my $file = "resources/solaris/psrinfo/$test-psrinfo_v"; + my @cpus = FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU::_getVirtualCPUs(file => $file); + is(scalar @cpus, $vpcu_tests{$test}->[0], "virtual cpus count: $test"); + is_deeply($cpus[0], $vpcu_tests{$test}->[1], "virtual cpus values: $test"); } -foreach my $test (keys %spec_tests) { - my @results = FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU::_parseSpec($test); - is_deeply(\@results, $spec_tests{$test}, "spec parsing: $test" ); +foreach my $test (keys %pcpu_tests) { + my $file = "resources/solaris/psrinfo/$test-psrinfo_vp"; + my @cpus = FusionInventory::Agent::Task::Inventory::Input::Solaris::CPU::_getPhysicalCPUs(file => $file); + is(scalar @cpus, $pcpu_tests{$test}->[0], "physical cpus count: $test" ); + is_deeply($cpus[0], $pcpu_tests{$test}->[1], "physical cpus values: $test"); }