DevTech101

DevTech101
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)
Loading...

How to get the CPU/core and thread count in Solaris.

#!/bin/bash
nproc=`(/usr/bin/kstat -m cpu_info | grep chip_id | sort -u | wc -l | tr -d ' ')`
vproc=`(/usr/bin/kstat -m cpu_info | grep 'module: cpu_info' | sort -u | wc -l | tr -d ' ')`
ncore=`(/usr/bin/kstat -m cpu_info | grep core_id | sort -u | wc -l | tr -d ' ')`
 
echo "Total number of physical processors: $nproc"
echo "Number of virtual processors: $vproc"
echo "Total number of cores: $ncore"
echo "Number of cores per physical processor: $(($ncore/$nproc))"
echo "Number of hardware threads (strands) per core: $(($vproc/$ncore))"

Output example

./get_cpu_core_count.sh
Total number of physical processors: 2
Number of virtual processors: 16
Total number of cores: 12
Number of cores per physical processor: 6
Number of hardware threads (strands) per core: 1

Update: Simpler core count script, to get the script click here
Output example

CPUs  Cores Threads Operating System cpuType
4     64    512     SunOS 5.11       sun4v-platform 3600 MHz
%d bloggers like this: