How to count number of physical and virtual processors on Solaris machine.?

hi,
I am using command

psrinfo -p

to check the number of physical processors present on any soalris machine.I want to check the number of virtual processors assigned for particular solaris machine.

which command/set of command need to be used which can grep or show the total virtual processors of solaris machine.

Just omit "-p":

psrinfo

thanks ... can you show or describe me what will be the output of

psrinfo 

in case there are more than 1 virtual processors.

for eg : in case there are 2 virtual processors then whether the output of psrinfo will be as shown below or something different
bash-3.2# psrinfo
2 on-line since 09/23/2013 14:50:59

There should be one line of output per virtual processor, so if you had two virtual CPUs, you should see two lines of output. If you are receiving only a single line, then your system sees a single virtual CPU.

You can also add the -v switch to the -p and get the number of virtual processors:

psrinfo -pv
The physical processor has 8 virtual processors (0-7)

i am receiving output as below :

 
bash-3.2# psrinfo
0       on-line   since 09/23/2013 14:50:59

does that means there is 1 virtual processors and

bash-3.2# psrinfo -p
1

so number of physical processors available is 1.
and

 
bash-3.2# psrinfo -pv
The physical processor has 1 virtual processor (0)
  x86 (chipid 0x0 GenuineIntel family 6 model 26 step 4 clock 2933 MHz)
        Intel(r) Xeon(r) CPU           X5670  @ 2.93GHz

so this means my soalris machien has one virtual and one physical processsor...please correct me if i am wrong.:slight_smile:

Also, this is "contemporary"... which practically means safe to use... just want to note that on Sun architectures that are older, the command won't necessarily produce "good" results...

So.. if... for example, you have SPARC IIIi, there are certain processors there that won't produce accurate data (don't worry it's a very limited few).

But for the most part, things work ok.

Personally, x86 has never been Sun's forte... I wouldn't trust it to produce anything reliable.

thank you all for all the answers..it was really very helpfull.

now i am trying to have only the number i.e only the numerical value that will represnt the virtual processor count out of the below command output:

 
bash-3.2#  psrinfo -pv | head -1
The physical processor has 1 virtual processor (0)
 
output required : 1

what will be the most effective way to get the numerical value out of it..i know this is very silly and basic question but i am beginner in the admin field

Simply count lines in "psrinfo":

psrinfo | wc -l