7 Ways to find CPU information from Solaris

CPU-informationTraditionally, in Solaris computing world the word CPU refers to a Chip planted on the mother board.  
Starting from Solaris10, the term vCPU has been introduced to refer each computing entity, ( CPU Sockets, CPU Cores per Socket or  Hardware Threads per a CPU Core)  which can schedule and implement processes independent to other vCPU.
There are several ways to know about CPU information in Solaris, this article will help you to grab CPU information from your solaris machine.

Way 1:     Using psrinfo

psrinfo displays information about processors. Each physical processor may support multiple virtual processors.
Each virtual processor is an entity with its own interrupt ID, capable of executing independent threads.

Sytax :   

     psrinfo [-p] [-v] [processor_id…]

    psrinfo [-p] -s processor_id
Example : 
% psrinfo -v
Status of virtual processor 0 as of: 03/29/2012 10:07:52
on-line since 09/27/2011 03:17:48.
The sparcv9 processor operates at 1500 MHz,
and has a sparcv9 floating point processor.
Status of virtual processor 1 as of: 03/29/2012 10:07:52
on-line since 09/27/2011 03:17:48.
The sparcv9 processor operates at 1500 MHz,
and has a sparcv9 floating point processor.
— snip —
 
::: Sample output for Sun Fire 4800
% psrinfo -pv
The physical processor has 2 virtual processors (0 512)
UltraSPARC-IV+ (portid 0 impl 0x19 ver 0x22 clock 1500 MHz)
The physical processor has 2 virtual processors (1 513)
UltraSPARC-IV+ (portid 1 impl 0x19 ver 0x22 clock 1500 MHz)
             :::: trim the output ::::::
The physical processor has 2 virtual processors (18 530)
UltraSPARC-IV+ (portid 18 impl 0x19 ver 0x21 clock 1500 MHz)
The physical processor has 2 virtual processors (19 531)
UltraSPARC-IV+ (portid 19 impl 0x19 ver 0x21 clock 1500 MHz)
 
 
:: Sample output for SUNW,Netra-T5440
# psrinfo -vp
The physical processor has 8 cores and 64 virtual processors (0-63)
The core has 8 virtual processors (0-7)
The core has 8 virtual processors (8-15)
The core has 8 virtual processors (16-23)
The core has 8 virtual processors (24-31)
The core has 8 virtual processors (32-39)
The core has 8 virtual processors (40-47)
The core has 8 virtual processors (48-55)
The core has 8 virtual processors (56-63)
UltraSPARC-T2+ (chipid 0, clock 1165 MHz)
The physical processor has 8 cores and 64 virtual processors (64-127)
The core has 8 virtual processors (64-71)
The core has 8 virtual processors (72-79)
The core has 8 virtual processors (80-87)
The core has 8 virtual processors (88-95)
The core has 8 virtual processors (96-103)
The core has 8 virtual processors (104-111)
The core has 8 virtual processors (112-119)
The core has 8 virtual processors (120-127)
UltraSPARC-T2+ (chipid 1, clock 1165 MHz)
 

Way 2:  Using Kstat command

Syntax :   # kstat -p cpu_info
% kstat -p cpu_info | less
cpu_info:0:cpu_info0:brand UltraSPARC-IV+
cpu_info:0:cpu_info0:chip_id 0
cpu_info:0:cpu_info0:class misc
cpu_info:0:cpu_info0:clock_MHz 1500
cpu_info:0:cpu_info0:core_id 0
cpu_info:0:cpu_info0:cpu_fru hc:///component=/N0/SB0
cpu_info:0:cpu_info0:cpu_type sparcv9
cpu_info:0:cpu_info0:crtime 555.99622024
cpu_info:0:cpu_info0:current_clock_Hz 1500000000
cpu_info:0:cpu_info0:device_ID 9223374340875157564
cpu_info:0:cpu_info0:fpu_type sparcv9
cpu_info:0:cpu_info0:implementation UltraSPARC-IV+ (portid 0 impl 0x19 ver 0x22 clock 1500 MHz)
cpu_info:0:cpu_info0:pg_id 2
cpu_info:0:cpu_info0:snaptime 15922865.060229
cpu_info:0:cpu_info0:state on-line
cpu_info:0:cpu_info0:state_begin 1317086268
cpu_info:0:cpu_info0:supported_frequencies_Hz 1500000000
cpu_info:1:cpu_info1:brand UltraSPARC-IV+
cpu_info:1:cpu_info1:chip_id 1
cpu_info:1:cpu_info1:class misc
cpu_info:1:cpu_info1:clock_MHz 1500
cpu_info:1:cpu_info1:core_id 1
cpu_info:1:cpu_info1:cpu_fru hc:///component=/N0/SB0
cpu_info:1:cpu_info1:cpu_type sparcv9
cpu_info:1:cpu_info1:crtime 556.910962
cpu_info:1:cpu_info1:current_clock_Hz 1500000000
cpu_info:1:cpu_info1:device_ID 9223374340791271484
cpu_info:1:cpu_info1:fpu_type sparcv9
cpu_info:1:cpu_info1:implementation UltraSPARC-IV+ (portid 1 impl 0x19 ver 0x22 clock 1500 MHz)
cpu_info:1:cpu_info1:pg_id 4
cpu_info:1:cpu_info1:snaptime 15922865.0607254
cpu_info:1:cpu_info1:state on-line
cpu_info:1:cpu_info1:state_begin 1317086268
cpu_info:1:cpu_info1:supported_frequencies_Hz 1500000000
— snip —

Way 3:  Using prtdiag

% prtdiag -v
System Configuration: Oracle Corporation sun4u Sun Fire 4800
System clock frequency: 150 MHz
Memory size: 98304 Megabytes
 
========================= CPUs =============
 
CPU Run    E$      CPU  CPU
FRU Name   ID      MHz  MB  Impl. Mask
———- ——- —- —- ——- —-
/N0/SB0/P0 0,512 1500 32.0 US-IV+ 2.2
/N0/SB0/P1 1,513 1500 32.0 US-IV+ 2.2
/N0/SB0/P2 2,514 1500 32.0 US-IV+ 2.2
/N0/SB0/P3 3,515 1500 32.0 US-IV+ 2.2
/N0/SB2/P0 8,520 1500 32.0 US-IV+ 2.1
/N0/SB2/P1 9,521 1500 32.0 US-IV+ 2.1
/N0/SB2/P2 10,522 1500 32.0 US-IV+ 2.1
/N0/SB2/P3 11,523 1500 32.0 US-IV+ 2.1
/N0/SB4/P0 16,528 1500 32.0 US-IV+ 2.1
/N0/SB4/P1 17,529 1500 32.0 US-IV+ 2.1
/N0/SB4/P2 18,530 1500 32.0 US-IV+ 2.1
/N0/SB4/P3 19,531 1500 32.0 US-IV+ 2.1
 

Way 4: Using prtpicl

# prtpicl -v 
— snip —
cpu (cpu, de00000614)
:StateBegin Tue Sep 27 03:17:48 2011
:FPUType sparcv9
:ProcessorType sparcv9
:State on-line
:ID 0
:UnitAddress 0
:device_type cpu
:compatible SUNW,UltraSPARC-IV+
:reg 00 00 00 00
:cpuid 0
:clock-frequency 0x59682f00
:mask# 0x22
:implementation# 0x19
:manufacturer# 0x3e
:sparc-version 0x9
:l1-icache-size 0x10000
:l1-icache-line-size 0x40
:l1-icache-associativity 0x4
:#itlb-entries 0x10
:l1-dcache-size 0x10000
:l1-dcache-line-size 0x20
:l1-dcache-associativity 0x4
:#dtlb-entries 0x10
:l2-cache-size 0x200000
:l2-cache-line-size 0x40
:l2-cache-associativity 0x4
:l3-cache-size 0x2000000
:l3-cache-line-size 0x40
:l3-cache-associativity 0x4
:l2-cache-sharing 00 00 00 00 00 00 00 03
:l3-cache-sharing 00 00 00 00 00 00 00 03
:devfs-path /ssm@0,0/cmp/cpu
:binding-name cpu
:instance -1
:_class cpu
:name cpu
— snip —

Way 5:  Using SC commands

sc> showenvironment
=============== Environmental Status ===============
 
——————————————————————————–^M
System Temperatures (Temperatures in Celsius):^M
——————————————————————————–^M
Sensor           Status Temp LowHard LowSoft LowWarn HighWarn HighSoft HighHard
——————————————————————————–^M
PDB/T_AMB        OK      21  -10     -5      0       45       50     55
MB/T_AMB         OK      24  -10     -5      0       50       55     60
MB/CMP0/T_TCORE  OK      48  -10     -5      0       85       90     95
MB/CMP0/T_BCORE  OK      47  -10     -5      0       85       90     95
IOBD/IOB/T_CORE  OK      40  -10     -5      0       95      100    105
IOBD/T_AMB       OK      28  -10     -5      0       52       57     62
 
 
messages / console-output / consolehistory
 
Tx000/consolehistory_-v:cpu0: UltraSPARC-T1 (chipid 0, clock 1400 MHz)
Tx000/consolehistory_-v:cpu1: UltraSPARC-T1 (chipid 0, clock 1400 MHz)
Tx000/consolehistory_-v:cpu2: UltraSPARC-T1 (chipid 0, clock 1400 MHz)
Tx000/consolehistory_-v:cpu3: UltraSPARC-T1 (chipid 0, clock 1400 MHz)

Way 6 :  smbios  (for  x86 systems)

% smbios
Level: 2
Maximum Installed Size: 1048576 bytes
Installed Size: 1048576 bytes
Speed: Unknown
Supported SRAM Types: 0x10
SMB_CAT_PBURST (pipeline burst)
Current SRAM Type: 0x10 (pipeline burst)
Error Correction Type: 5 (single-bit ECC)
Logical Cache Type: 5 (unified)
Associativity: 5 (4-way set associative)
Mode: 2 (varies by address)
Location: 0 (internal)
Flags: 0x1
SMB_CAF_ENABLED (enabled at boot time)
 
ID SIZE TYPE
7 127 SMB_TYPE_PROCESSOR (processor)
 
Manufacturer: AMD
Version: Dual Core AMD Opteron(tm) Processor 285
Serial Number: N/A
Asset Tag: N/A
Location Tag: CPU2
Part Number: N/A
 
Family: 132 (Opteron)
CPUID: 0x178bfbff00020f12
Type: 3 (central processor)
Socket Upgrade: 17 (socket 940)
Socket Status: Populated
Processor Status: 1 (enabled)
Supported Voltages:
External Clock Speed: Unknown
Maximum Speed: 2600MHz
Current Speed: 2600MHz
L1 Cache: 8
L2 Cache: 9
L3 Cache: None
 
— snip —

Way 7: using showhardconf from XSCF prompt

 
XSCF> showhardconf
SPARC Enterprise M5000;
+ Serial:BCF07500B6; Operator_Panel_Switch:Locked;
+ Power_Supply_System:Dual; SCF-ID:XSCF#0;
+ System_Power:On; System_Phase:Cabinet Power On;
Domain#0 Domain_Status:Initialization Phase;
Domain#1 Domain_Status:Initialization Phase;
 
MBU_B Status:Normal; Ver:4401h; Serial:BC07490823 ;
+ FRU-Part-Number:CF00541-4360 01 /541-4360-01 ;
+ Memory_Size:64 GB;
+ Type:2;
CPUM#0-CHIP#0 Status:Normal; Ver:0601h; Serial:PP0723016Q ;
+ FRU-Part-Number:CA06761-D205 A0 /371-4932-01 ;
+ Freq:2.660 GHz; Type:48;
+ Core:4; Strand:2;
CPUM#3-CHIP#1 Status:Normal; Ver:0601h; Serial:PP074804E9 ;
+ FRU-Part-Number:CA06761-D205 A0 /371-4932-01 ;
+ Freq:2.660 GHz; Type:48;
+ Core:4; Strand:2;
[…]
— snip —
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

3 Responses

  1. Cicuta says:

    You missed Using prtconf
    Based on the installed drivers, you can find the information on the CPUs on the system.

    Here are some other good commands for hardware information and troubleshooting:

    usr/platform/`uname -i`/

    sbin/prtdiag -v (sun4u and sun4d only)

    arch -k

    isainfo -v

    dmesg

    iostat -En … This command is excellent to see overload of CPUs and paging and without the n switch is good to pintpoint which drive is giving problems (amber LED flashes to indicate the bad drive)

    prtfru

    cfgadm -l

    /etc/path_to_inst …….Note: This particular file must not be changed but is always a good idea to keep a backup at a different location. The file gets recycled every time the system reboots and if anything has changed hardware wise it will incorporate those changes in the file. It maps every single physical device to its logical name. It is the most important file in the system.

    Here is the link on “How to Recover From a Corrupted /etc/path_to_inst File”

    http://docs.oracle.com/cd/E19050-01/sun.cluster31/819-1405/auto22/index.html

    Have a good day and fun!

  2. Cicuta says:

    Errata:
    Actually is for I/O statistics and without the n is to pinpoint a bad drive. The command for CUP load and paging among other things is vmstat.

  3. Ben Audet says:

    Il my opinion, it lacks the most interesting CPU information in this post… …which is CPU usage! The most interesting commands in Solaris to do so are:

    The “mpstat” command, which shows usage for each CPU thread in real time (if you mention time interval as option to the command):

    # mpstat
    CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys st idl
    0 7 0 317 236 7 96 1 10 43 0 371 2 7 0 91
    1 31 0 269 60 3 343 1 35 65 1 909 6 3 0 92
    2 14 0 141 34 5 222 1 13 26 0 740 2 2 0 96
    3 7 0 68 22 1 70 0 8 14 0 179 1 1 0 98
    4 8 0 90 31 4 69 0 10 23 0 157 1 1 0 98
    5 28 0 248 69 4 270 1 29 60 1 701 4 3 0 93
    6 17 0 94 38 4 70 1 10 34 0 293 4 1 0 94
    7 8 0 82 23 4 96 0 10 17 0 323 1 1 0 98
    8 7 0 128 106 80 70 0 10 16 0 190 2 1 0 97
    9 11 0 74 25 2 87 0 10 22 0 224 2 1 0 97
    10 28 0 376 70 6 360 1 29 58 1 1103 5 3 0 92
    11 21 0 152 37 2 120 1 11 27 0 353 3 1 0 96
    12 7 0 140 28 3 67 0 11 16 0 135 1 1 0 98
    13 12 0 101 28 2 105 0 14 35 0 289 2 1 0 97
    14 28 0 253 73 6 226 1 31 50 1 561 4 2 0 94
    15 23 0 178 35 2 171 1 13 24 0 705 3 2 0 95
    16 12 0 120 33 1 154 0 15 28 0 423 3 1 0 96
    17 9 0 81 29 4 84 0 10 13 0 151 1 1 0 98
    18 10 0 79 35 4 74 0 9 22 0 179 1 1 0 98
    19 29 0 337 68 5 300 1 44 78 1 681 4 2 0 93
    20 13 0 286 33 2 71 0 10 25 0 261 3 1 0 96
    21 7 0 93 31 4 72 0 12 18 0 164 1 1 0 98
    22 11 0 158 32 2 68 0 11 22 0 161 3 1 0 96
    23 40 0 288 86 6 309 1 39 60 1 812 5 3 0 93
    24 30 0 266 64 3 329 1 32 57 1 763 5 2 0 92
    25 12 0 108 39 2 121 1 10 22 0 333 4 1 0 95
    26 6 0 104 26 3 47 0 8 19 0 105 3 1 0 96
    27 18 0 83 37 2 154 1 16 25 0 368 3 1 0 95
    28 27 0 244 71 5 196 1 22 72 1 765 7 2 0 91
    29 11 0 101 36 2 171 0 15 31 0 363 2 1 0 97
    30 6 0 37 21 3 43 0 8 12 0 98 1 0 0 99
    31 8 0 43 23 2 75 0 11 20 0 265 1 1 0 98

    In my opinion, this is the most interesting command related to CPUs in Solaris: it can show you, for example, if your applications are using threading, or if some threads are draining the whole machine down on CPU point of vue.

    The “prstat” command. There is so many options to use with this command to drill down CPU (and other resources) usage by processes, zones, and so on!! Just as an intro, just go with the most easy one: “prstat -a” will show you top processes with resource usage (RSS memory, CPU, etc.), and in the bottom of the page, you’ll find a global summary:

    # prstat -a
    PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
    1333 root 1060M 895M sleep 59 0 0:02:30 4.6% java/106
    5 root 0K 0K sleep 99 -20 0:00:08 0.0% zpool-rpool/190
    598 root 0K 0K sleep 99 -20 0:00:04 0.0% zpool-opscenter/190
    1385 root 34M 17M sleep 59 0 0:00:00 0.0% pkg.depotd/64
    878 root 5472K 4336K sleep 59 0 0:00:00 0.0% login/2
    689 root 25M 15M sleep 59 0 0:00:00 0.0% ldmd/16
    15 root 25M 25M sleep 59 0 0:01:22 0.0% svc.configd/28
    6 root 0K 0K sleep 99 -20 0:00:00 0.0% kmem_task/1
    1550 root 11M 8040K cpu5 49 0 0:00:00 0.0% prstat/1
    869 root 39M 30M sleep 59 0 0:00:06 0.0% fmd/38
    468 root 20M 10M sleep 59 0 0:00:01 0.0% nscd/32
    137 root 3608K 2712K sleep 60 -20 0:00:00 0.0% zonestatd/5
    87 root 10M 1952K sleep 59 0 0:00:00 0.0% in.mpathd/1
    58 netadm 5400K 4648K sleep 59 0 0:00:00 0.0% ipmgmtd/6
    43 netcfg 4664K 4088K sleep 59 0 0:00:00 0.0% netcfgd/4
    NPROC USERNAME SWAP RSS MEMORY TIME CPU
    61 root 1257M 1155M 14% 0:05:05 4.7%
    5 webservd 17M 14M 0.2% 0:00:00 0.0%
    5 daemon 5336K 18M 0.2% 0:00:00 0.0%
    2 netadm 4184K 14M 0.2% 0:00:00 0.0%
    1 netcfg 1992K 4744K 0.1% 0:00:00 0.0%
    Total: 79 processes, 930 lwps, load averages: 1.95, 1.01, 0.43

    Use “prstat -Z” for a summary for each non-global zones on the machine as well…:

    # prstat -Z
    PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
    29969 baudet 7552K 5088K sleep 59 0 0:00:00 0.5% sshd/1
    29990 root 4040K 3192K cpu0 49 0 0:00:00 0.4% prstat/1
    29979 root 3456K 2528K sleep 49 0 0:00:00 0.2% bash/1
    4463 noaccess 139M 92M sleep 59 0 14:40:48 0.2% java/18
    3142 101 48M 18M sleep 59 0 13:53:13 0.2% mysqld/10
    1014 noaccess 147M 96M sleep 59 0 14:58:35 0.2% java/18
    137 daemon 5040K 2800K sleep 59 0 0:00:06 0.2% kcfd/4
    2714 root 38M 33M sleep 59 0 2:38:01 0.1% named/4
    5 root 0K 0K sleep 99 -20 16:24:46 0.1% zpool-rpool/37
    29975 baudet 3456K 2496K sleep 59 0 0:00:00 0.1% bash/1
    29968 root 5592K 3576K sleep 59 0 0:00:00 0.1% sshd/1
    3400 root 2872K 1968K sleep 59 0 6:05:49 0.0% in.routed/1
    152 root 7640K 4528K sleep 59 0 1:07:18 0.0% nscd/33
    15945 root 9592K 3152K sleep 59 0 0:14:33 0.0% sendmail/1
    263 root 3088K 1920K sleep 100 – 1:12:00 0.0% xntpd/1
    2510 daemon 5208K 2128K sleep 59 0 0:36:34 0.0% nfsmapid/4
    3534 root 9920K 1216K sleep 59 0 0:37:38 0.0% snmpd/1
    2864 root 4336K 1168K sleep 59 0 2:03:29 0.0% ipmon/1
    2976 daemon 5208K 2136K sleep 59 0 0:37:16 0.0% nfsmapid/4
    284 root 3408K 1736K sleep 59 0 0:31:41 0.0% cron/1
    3544 root 9584K 3096K sleep 59 0 0:20:59 0.0% sendmail/1
    3464 root 9584K 3080K sleep 59 0 0:21:48 0.0% sendmail/1
    3296 daemon 6392K 2312K sleep 59 0 0:41:24 0.0% nfsmapid/5
    2885 root 9400K 6952K sleep 59 0 1:05:54 0.0% nscd/37
    15648 root 7520K 4312K sleep 59 0 0:22:35 0.0% nscd/29
    3974 root 9584K 3088K sleep 59 0 0:23:06 0.0% sendmail/1
    15746 daemon 5216K 2120K sleep 59 0 0:23:20 0.0% nfsmapid/4
    ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
    0 48 219M 145M 9.4% 38:11:16 1.8% global
    4 33 206M 165M 11% 20:13:54 0.4% svprdns01
    1 29 78M 39M 2.6% 16:50:53 0.2% svprsql01
    2 31 47M 32M 2.1% 21:03:34 0.1% svprfrw01
    9 27 42M 28M 1.8% 2:28:01 0.0% svprweb01

    As well, you can use “sar” to output global percentage usage of CPU resource (as an average usage for all CPUs). Default behavior of “sar” is for CPU usage, but explicitly, use the “-u” option to show it:

    # sar

    SunOS orion 5.10 Generic_144488-17 sun4u 01/29/2015

    00:00:00 %usr %sys %wio %idle
    00:01:00 2 7 0 91
    00:02:01 1 2 0 97
    00:03:00 1 2 0 97
    00:04:00 1 2 0 97

    01:25:01 30 12 0 58
    01:26:01 32 17 0 52
    01:27:00 30 12 0 58
    01:28:00 30 12 0 58
    01:29:01 31 12 0 57

    08:37:00 5 4 0 91
    08:38:00 15 8 0 77
    08:39:00 23 11 0 66
    08:40:01 23 11 0 66
    08:41:00 13 12 0 75

    Average 3 4 0 93

    The “vmstat” command as well, will show you CPU usage a bit like “sar” does (at the right-end part):

    # vmstat
    kthr memory page disk faults cpu
    r b w swap free re mf pi po fr de sr s0 s3 s3 — in sy cs us sy id
    0 0 3 3771544 61488 20 85 0 0 0 0 1 3 3 -0 0 507 290 235 2 4 94

    And yes, this is a SHORT list!! We could pass a big part of the day drilling it down… Solaris is a MONSTER of resource management!!!

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us