• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to find Number of Physical/Logical CPUs, cores and memory in Solaris

by admin

Sometimes it becomes a bit tricky to gather CPU and memory information, especially with t-series hardware with LDOMs installed on it. The article takes an example of T5240 server to gather hardware information like physical/logical CPUs and memory. T5240 that I use, have the following specs :

CPU type Physical CPUs Virtual/logical CPUs (threads) Memory
UltraSPARC T2 Plus 2 128 64 GB

Gathering CPU related information

Finding physical/logical CPUs
To find the number of physical CPUs on any system use the -p option with psrinfo command. The -p option may not work with solaris 9 and below. In that case use the kstat command to find the physical CPUs.

# psrinfo -p
2

In case you need more detailed output use -v with the above command :

# psrinfo -pv
The physical processor has 64 virtual processors (0-63)
  UltraSPARC-T2+ (cpuid 0 clock 1165 MHz)
The physical processor has 64 virtual processors (64-127)
  UltraSPARC-T2+ (cpuid 64 clock 1165 MHz)

Now psrinfo or psrinfo -v would display all the logical/virtual CPUs. So in case of a T5240 it would show all the threads across all cores and CPUs.

# psrinfo -v | more
Status of virtual processor 0 as of: 08/12/2009 12:01:00
  on-line since 08/08/2009 06:03:02.
  The sparcv9 processor operates at 1165 MHz,
        and has a sparcv9 floating point processor.
Status of virtual processor 1 as of: 08/12/2009 12:01:00
  on-line since 08/08/2009 06:03:05.
  The sparcv9 processor operates at 1165 MHz,
        and has a sparcv9 floating point processor.
Status of virtual processor 2 as of: 08/12/2009 12:01:00
  on-line since 08/08/2009 06:03:05.
  The sparcv9 processor operates at 1165 MHz,
        and has a sparcv9 floating point processor.
.........

To calculate totale number of threads in T5240, simply sum up the output in psrinfo command :

# psrinfo | wc -l
128

Finding cores
To find total number of cores across all the CPUs :

# kstat cpu_info|grep core_id|sort -u|wc -l
      16

Now to find number of core per CPU simply do the math : total number of cores / total number of physical CPUs

Another way of gathering CPU related info is using the prtdiag command :

# prtdiag -v | more
System Configuration:  Oracle Corporation  sun4v SPARC T2+
    Memory size: 65536 Megabytes
    
    ================================ Virtual CPUs     ================================
    
    
    CPU ID Frequency Implementation         Status
    ------ --------- ---------------------- -------
    0      1400 MHz  SPARC-T2+               on-line  
    1      1400 MHz  SPARC-T2+               on-line  
    2      1400 MHz  SPARC-T2+               on-line  
    3      1400 MHz  SPARC-T2+               on-line  
    4      1400 MHz  SPARC-T2+               on-line  
    5      1400 MHz  SPARC-T2+               on-line  
    6      1400 MHz  SPARC-T2+               on-line  
    7      1400 MHz  SPARC-T2+               on-line  
    8      1400 MHz  SPARC-T2+               on-line  
    9      1400 MHz  SPARC-T2+               on-line  
    10     1400 MHz  SPARC-T2+               on-line  
    11     1400 MHz  SPARC-T2+               on-line  
    12     1400 MHz  SPARC-T2+               on-line  
    13     1400 MHz  SPARC-T2+               on-line  
    14     1400 MHz  SPARC-T2+               on-line  
    15     1400 MHz  SPARC-T2+               on-line  
    
    ....

Getting the CPU and core mapping
The small script here gives the CPU and core mapping on the server. In case of T5240 it will show which thread lies on which CPU core.

# cat cpu-core-mapping.sh
#!/bin/ksh
kstat cpu_info | 
    egrep "cpu_info |core_id" | 
    awk 
        'BEGIN { printf "%4s %4s", "CPU", "core" } 
         /module/ { printf "n%4s", $4 } 
         /core_id/ { printf "%4s", $2} 
         END { printf "n" }'

The output from running the script :

# ./cpu-core-mapping.sh
 CPU core
   0   0
   1   0
   2   2
   3   2
  40  40
  41  40
  42  42
  43  42
  .......

Gathering Memory information

Getting memory information is trivial. use the prtconf command and grem for Memory :

# prtconf | grep Memory
Memory size: 65536 Megabytes

We can also use the prtdiag command to find the memory in the system :

# prtdiag -v | grep Memory
    Memory size: 65536 Megabytes

Finding CPU information on T-series hardware with LDOMs

If you have LDOMs installed on the T-series hardware tyhat you have, above commands may not give you the correct values. Use the “ldm list-devices -a” command to list core, virtual CPUs (VCPUs) and resource assignments.

# ldm list-devices -a
CORE ID    %FREE   CPUSET
    0       12      (0, 1, 2, 3, 4, 5, 6, 7)
    1       0       (8, 9, 10, 11, 12, 13, 14, 15)
    2       0       (16, 17, 18, 19, 20, 21, 22, 23)
    3       0       (24, 25, 26, 27, 28, 29, 30, 31)
    4       0       (32, 33, 34, 35, 36, 37, 38, 39)
    5       0       (40, 41, 42, 43, 44, 45, 46, 47)
    6       0       (48, 49, 50, 51, 52, 53, 54, 55)
    7       0       (56, 57, 58, 59, 60, 61, 62, 63)
    8       0       (64, 65, 66, 67, 68, 69, 70, 71)
    9       0       (72, 73, 74, 75, 76, 77, 78, 79)
    10      0       (80, 81, 82, 83, 84, 85, 86, 87)
    11      0       (88, 89, 90, 91, 92, 93, 94, 95)
    12      0       (96, 97, 98, 99, 100, 101, 102, 103)
    13      0       (104, 105, 106, 107, 108, 109, 110, 111)
    14      0       (112, 113, 114, 115, 116, 117, 118, 119)
    15      0       (120, 121, 122, 123, 124, 125, 126, 127)
    16      0       (128, 129, 130, 131, 132, 133, 134, 135)
...........................

Filed Under: Solaris

Some more articles you might also be interested in …

  1. How to Configure TCP Keepalive option in Solaris
  2. How to configure Network Bridging in Solaris 11
  3. How to enable XDMCP in GNOME Display Manager (gdm) for Solaris 10,11
  4. How to configure Shared Memory Parameters in Solaris 10,11
  5. How to Install Oracle Solaris 11 (Text Installer)
  6. How to Use the ‘truss’ Command for Program and Error Analysis in Solaris
  7. How to add Additional Storage Space Created from Dynamic LUN Expansion in SVM online
  8. How to verify non-global solaris zone is installed
  9. How to configure NTP client in Solaris 8,9,10 and non-global zones
  10. How to Identify ZFS Snapshot Differences using “zfs diff”

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright