Operating System - HP-UX
1837238 Members
2084 Online
110115 Solutions
New Discussion

Re: how to identify processor?

 
SOLVED
Go to solution
Costin Apostol
New Member

how to identify processor?

Hi,

How can I find out in hpux what processor do I have?

I can only find my machine type:
bash-2.03# model
9000/785/B1000

How do I get the processor type? I need something like PA8500...

It does not matter if it is C++ code or shell command...

Thanks,
Costin

17 REPLIES 17
Steven E. Protter
Exalted Contributor

Re: how to identify processor?

Shalom,

model command.

Better yet, http://docs.hp.com

It says exactly what processor is in your system.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Peter Godron
Honored Contributor
Solution

Re: how to identify processor?

Costin Apostol
New Member

Re: how to identify processor?

I really need a C++ code or shell command...

Thanks
siva0123
Trusted Contributor

Re: how to identify processor?

Hi,

echo "selclass type proc;info;wait;infolog" | cstm

This should help you i think


Thanks,
siva
Peter Godron
Honored Contributor

Re: how to identify processor?

C ostin,
please read the info in the link I provided.

In Procura's answer are a number of ways of getting the info:

echo "selclass qualifier cpu;infolog" | /usr/sbin/cstm | grep "CPU Module"
Pete Randall
Outstanding Contributor

Re: how to identify processor?

Try this:

MODEL=$(grep -i $(model | tr "/" " " \
| awk '{print $NF}') \
/usr/sam/lib/mo/sched.models \
| awk '{print $NF}')
echo $MODEL


Pete

Pete
Costin Apostol
New Member

Re: how to identify processor?

Sorry, none worked :(

1. /usr/sam/lib/mo/sched.models does not contain B1000 on my machine.

2. cstm, mstm, xstm do not exist on my machine.

Do you think I have any chance to get the information I need?

bash-2.03# uname -a
HP-UX Janus B.11.00 U 9000/785 2014840735 unlimited-user license

bash-2.03# model
9000/785/B1000
siva0123
Trusted Contributor

Re: how to identify processor?

Hi,

If there is now way to find it , why dont you hardcode it in your program.

9000/785/B1000 has the following processor
PA 8500 processor at 300MHz

Thanks,
siva
Pete Randall
Outstanding Contributor

Re: how to identify processor?

Well, I can tell you that your B1000 has a PA-8500 processor that runs at either 300 or 400 Mhz, if that helps.


Pete

Pete
Peter Godron
Honored Contributor

Re: how to identify processor?

Costin,
if it helps (from my machine):
$ grep B1000 /usr/sam/lib/mo/sched.models
B1000 2.0 PA8500

which cstm
/usr/sbin/cstm

I would suggest:
1. you load the cstm etc tools.
2. Update to 11.11 ,as 11.00 support ends 31/12/06
Costin Apostol
New Member

Re: how to identify processor?

The only way to find my information seems to be

bash-2.03# model
9000/785/B1000

bash-2.03# cat /usr/sam/lib/mo/sched.models | grep 785
785 2.0 PA8500


But can I trust this information?
In http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=558731
i find that:

d3:/wrk 105 > model
9000/800/D390
d3:/wrk 105 > grep -i d390 /opt/langtools/lib/sched.models
D390 2.0 PA8200
d3:/wrk 106 > grep -i d390 /usr/sam/lib/mo/sched.models
D390 2.0 PA8000
d3:/wrk 107 > echo "selclass qualifier cpu;info;wait;infolog" | /usr/sbin/cstm | grep "CPU Module"
PA 8200 CPU Module 5.1

Diffent commands, different values. Who do I trust?

The program will run on various machines, not only mine, and should give accurate results.
H.Merijn Brand (procura
Honored Contributor

Re: how to identify processor?

did you try my script (1) that incorporates all the tests?
I have explained most of it in the FAQ (2)

1: http://mirrors.develooper.com/hpux/ux
2: http://mirrors.develooper.com/hpux/faq.html

# ux
a5 HP-UX 11.00/64 U 9000/800/A500-7X/64 PA8700/750(2) pa-2.0 2048 Mb

And when you're in doubt, the cstm command gives more reliable info the the grep from the static files. The above mentioned script prefers the files over the command, as that is both faster and never needs su permissions.

If you have the perl module Unix::Processors installed, try this:

# perl -MUnix::Processors -le'print join"\t",$_->id,$_->state,$_->type,$_->clock for @{Unix::Processors->new()->processors}'
0 online HP PA-RISC 2.0 750
1 online HP PA-RISC 2.0 750

but as you see, that won't give you the *exact* type.

perl also supports syscall ()'s, and in the "ux" script on line 58 and on, you see how that can be used to call syscall (239, ...) which is the SYS_pstat call, and the second argument being 10 is the PSTAT_PROCESSOR request, /usr/include/sys/pstat.h will show you more.


Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Frank de Vries
Respected Contributor

Re: how to identify processor?

to get all your device info you can run this
as root

echo "selclass qualifier all;info;wait;infolog" | cstm | tee -a device.log

(It includes the model command)

And look for the cpu part in your device.log




Look before you leap
Frank de Vries
Respected Contributor

Re: how to identify processor?

Oops forgot to upload the output file:
The section you need to look for
in device.log
Look before you leap
H.Merijn Brand (procura
Honored Contributor

Re: how to identify processor?

You can get the *exact* model with this C program snippet, but (for now) only as a code, not as a CPU type string ...

--8<--- xx.c
#include
#include

int main (int argc, char *argv[])
{
long sc = sysconf (_SC_CPU_CHIP_TYPE);
printf ("sysconf (%d CPU_CHIP_TYPE) = %ld\n", _SC_CPU_CHIP_TYPE, sc);
return (errno);
} /* main */
-->8---

Above code is unsupported on HP-UX 10.20

# cc +DD64 -O -o xx xx.c
# ./xx
sysconf (10023 CPU_CHIP_TYPE) = 616
#

Local tests here reveal:

PA8500 : 552 (0x00000228)
PA8700 : 616 (0x00000268)
PA8800 : 644 (0x00000284)
Itanium2 : 520225284 (0x1F020204)

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: how to identify processor?

That C snippet is (of course :) :) also doable from the command line

# getconf CPU_CHIP_TYPE
616

On 10.20 you still get
getconf CPU_CHIP_TYPE: Invalid argument

http://www.openpa.net/cpu.html#table lists the hardware combo's, but not those values.

That made me google on CPU_CHIP_TYPE, and though rather dated, still interesting:
http://unix.derkeiler.com/Mailing-Lists/HP-UX-Admin/2003-04/0003.html

And a useful reference to some older discussion here, so I don't need to repeat myself:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=21381

Now, 'man confstr', which should yield the string representation of the code found by getconf (), is wrong (all _SC_'s written as _CS_), but that aside, it still returns zilch:

--8<---
#include
#include
#include

extern void *calloc (size_t, int);

int main (int argc, char *argv[])
{
size_t l;
long sc = sysconf (_SC_CPU_CHIP_TYPE);
char *cs = calloc (80, 1);

l = confstr (_SC_CPU_CHIP_TYPE, cs, 80);
printf ("sysconf (%d CPU_CHIP_TYPE) = 0x%08lx (%12ld) '%s' (%d)\n",
_SC_CPU_CHIP_TYPE, sc, sc, cs, l);
return (errno);
} /* main */
-->8---

/tmp 111 > ./xx
sysconf (10023 CPU_CHIP_TYPE) = 0x00000268 ( 616) '' (0)
Exit 22

Another interesting snippet from http://www.unixguide.net/scripts/stats151
--8<---
# plan A (getconf CPU_CHIP_TYPE)
##################################
if [ "$OSVER" -ge 1100 ]; then
typeset -i2 bin
bin=`getconf CPU_CHIP_TYPE`
typeset -i16 hex
hex=2#`echo $bin | sed -e 's/2#//' -e 's/.....$//'`
model_num=`echo $hex | cut -c4-`
case $model_num in
b) model_name=PA7200 ;;
d) model_name=PA7100LC ;;
e) model_name=PA8000 ;;
f) model_name=PA7300LC ;;
10) model_name=PA8200 ;;
11) model_name=PA8500 ;;
12) model_name=PA8600 ;;
13) model_name=PA8700 ;;
14) model_name=PA8800 ;;
15) model_name=PA8750 ;;
*) model_name= ;;
esac
[ -n "$model_name" ] && { echo $model_name ; return 0 ; }
fi
-->8---

And the pointers continue:
--8<---
CPU_CHIP_TYPE _SC_CPU_CHIP_TYPE Itanium(R)-based systems:
CPUID Register 3 of the
Itanium-based processor
identification registers.
See the Itanium-based
architecture definition for
this platform for the
meaning of each bit.
-->8---

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Costin Apostol
New Member

Re: how to identify processor?

Since all methods you suggested to me use dictionaries, I decided to use my own dictionary, based on `model` output and http://hwdb.parisc-linux.org/.

Using sched.models is having the dictionary at user host.
Using cstm is imposible since it is not on every machine.
Using `getconf CPU_CHIP_TYPE` is still a dictionay method and it happens not to be too accurate.