I have a C program I use to determine the number, type and speed of processors on a solaris system, which I have included at the end of this message. I am interested in coming up with similar scripts for HPUX, Tru64, Linux and AIX. Any suggestions as to what are the right system calls or, if anyone already has them, completed scripts, would be greatly appreciated.
Listing of program "CPUTYPE.C":
/home/jputnam/cputype >more CPUTYPE.C
#include <sys/types.h>
#include <sys/processor.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
main()
{
processorid_t info=0;
processor_info_t infop;
/* I have no idea how solaris selects the CPU info #, so I just looped from
0 to 1000... that should be good enough */
for(info=0; info < 1000; info++)
{
if(processor_info(info, &infop)!=-1)
{
fprintf(stderr, "#%d speed:%d\n", info, infop.pi_clock);
fprintf(stderr, "#%d type:%s\n", info, infop.pi_processor_type);
fprintf(stderr, "#%d FPU type:%s\n", info, infop.pi_fputypes);
fprintf(stderr, "#%d status:%s\n", info, (infop.pi_state ? "ON" : "OFF"));
}
}
}
:)
Joshua Putnam
Sr. Systems Administrator
Ascential Software
50 Washington Street
Westboro, MA 01581
(508) 366-3888 x3509
