Solaris 查詢CPU、Core、Thread

測試機型:T5120

查詢實體的CPU數,T5120只有一顆實體的CPU
bash-3.2# psrinfo -p
1

查詢CPU的明細資料
bash-3.2# psrinfo -pv
The physical processor has 64 virtual processors (0-63)
  UltraSPARC-T2 (chipid 0, clock 1165 MHz)

查詢CPU的Thrads明細資料,共有64個Threads
bash-3.2# psrinfo -v
Status of virtual processor 0 as of: 10/28/2015 13:20:34
  on-line since 10/26/2015 17:08:17.
  The sparcv9 processor operates at 1165 MHz,
        and has a sparcv9 floating point processor.
(略...)
Status of virtual processor 63 as of: 10/28/2015 13:20:34
  on-line since 10/26/2015 17:08:20.
  The sparcv9 processor operates at 1165 MHz,
        and has a sparcv9 floating point processor.

查系統的詳細資料也可以看到CPU的訊息
bash-3.2# prtdiag -v 
System Configuration:  Oracle Corporation  sun4v SPARC Enterprise T5120
0      1165 MHz  SUNW,UltraSPARC-T2     on-line
1      1165 MHz  SUNW,UltraSPARC-T2     on-line
2      1165 MHz  SUNW,UltraSPARC-T2     on-line
3      1165 MHz  SUNW,UltraSPARC-T2     on-line
4      1165 MHz  SUNW,UltraSPARC-T2     on-line
5      1165 MHz  SUNW,UltraSPARC-T2     on-line
6      1165 MHz  SUNW,UltraSPARC-T2     on-line
7      1165 MHz  SUNW,UltraSPARC-T2     on-line
8      1165 MHz  SUNW,UltraSPARC-T2     on-line
(略...)

列出CPU負載的狀態
bash-3.2 mpstat
CPU minf mjf xcal  intr ithr  csw icsw migr smtx  srw syscl  usr sys  wt idl
  0    0   0   20   204    0    9    0    1    1    0     7    0   1   0  99
  1    1   2   89    40   25   23    0    2    4    0    39    0   0   0 100
  2    0   0    8    10    1    8    0    0    1    0     7    0   0   0 100
  3    0   0    8     9    0    7    0    0    1    0     1    0   0   0 100
  4    0   0   89    90    1  177    0    0    6    0     2    0   2   0  98
  5    0   0    6    11    0   10    0    0    1    0     1    0   0   0 100

 
網路上有人分享一個Shell Script的方法。
資料來源:https://blogs.oracle.com/mandalika/entry/solaris_show_me_the_cpu
 
下載檔案:按這裡

執行結果
bash-3.2# ./cpuinfo.sh
Total number of physical processors: 1
Number of virtual processors: 64
Total number of cores: 8
Number of cores per physical processor: 8
Number of hardware threads (strands or vCPUs) per core: 8
Processor speed: 1165 MHz (1.16 GHz)

** Socket-Core-vCPU mapping **

Physical Processor 1 (chip id: 0):
        Core 1 (core id: 1028):
                vCPU ids: 0 - 7
        Core 2 (core id: 1035):
                vCPU ids: 8 - 15
        Core 3 (core id: 1042):
                vCPU ids: 16 - 23
        Core 4 (core id: 1049):
                vCPU ids: 24 - 31
        Core 5 (core id: 1056):
                vCPU ids: 32 - 39
        Core 6 (core id: 1063):
                vCPU ids: 40 - 47
        Core 7 (core id: 1070):
                vCPU ids: 48 - 55
        Core 8 (core id: 1077):
                vCPU ids: 56 - 63