* finding sys info, processor bits, mem size, etc
@ 1999-07-15 4:00 Erik Lindberg
1999-07-16 4:00 ` Wolfram Klaus
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Erik Lindberg @ 1999-07-15 4:00 UTC (permalink / raw)
Im looking for ways to find various DEC sys info such as physical memory
size, number of processors, etc, hopefully in the form of one or more
clever unix commands (like hinv for SGI) or utility scripts. Got any
ideas?
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: finding sys info, processor bits, mem size, etc
1999-07-15 4:00 finding sys info, processor bits, mem size, etc Erik Lindberg
@ 1999-07-16 4:00 ` Wolfram Klaus
1999-07-17 4:00 ` Adam Price
1999-07-23 4:00 ` Stuart R. Fuller
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Klaus @ 1999-07-16 4:00 UTC (permalink / raw)
Erik Lindberg <lindberg@roguewave.com> writes:
>Im looking for ways to find various DEC sys info such as physical memory
>size, number of processors, etc, hopefully in the form of one or more
>clever unix commands (like hinv for SGI) or utility scripts. Got any
>ideas?
>Thanks
If you don't mind a C-Program instead of a script, here is what I
hacked together some time ago. It works at least under 4.0x {x>=B}.
If you invoke it as
sysinfo AUTO_ACTION
for example it prints out the value of the AUTO_ACTION console
variable in addition to the system information, it noramlly prints out
when invoked without any arguments. Some but not all of the console
variables can be displayed this way.
Here is the code, have fun with it:
/* sysinfo: get system configuration. Args: try to get PROM-Variable */
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
#include <machine/hal/cpuconf.h>
#include <stdio.h>
#include <stdlib.h>
#define MEM 0
#define CPU 1
/* Sometimes MHZ or MEM or off by 1 (or more?)
* Well, not really off, but 600MHz looks better
* in the output than 599MHz.
* The issue with the memory seems to be that, memory
* used by the PAL or whatever is substracted from the
* physical memory. It looks odd to me having 511MB of RAM.
* This little ugly helper routine takes care of these two
* issues.
*/
int normalize (int what, int type)
{
if (type==MEM)
return ((what+8)/16)*16;
else if (type==CPU)
{
int actdist,mindist,min,
trueMHZ[]={0,25,33,50,66,75,100};
int numMHZ=sizeof(trueMHZ)/sizeof(trueMHZ[0]);
div_t cpu_MHZ=div(what,100);
min=0;
mindist=abs(cpu_MHZ.rem-trueMHZ[0]);
while (--numMHZ)
if ( (actdist=abs(cpu_MHZ.rem-trueMHZ[numMHZ]) ) < mindist)
{
mindist=actdist;
min=numMHZ;
}
return 100*cpu_MHZ.quot+trueMHZ[min];
}
else
return what;
}
int main (int argc, char* argv[])
{
caddr_t buffer[1024];
char *cpu_name;
int start, prev_start;
long proc_type;
struct cpu_info cpu;
struct {
int width;
int height;
} res_buffer ={0,0};
int env;
/* Machine Name */
start=0;
getsysinfo(GSI_PLATFORM_NAME, buffer, sizeof(buffer), &start);
printf("Machine-Type\t %s\n", buffer);
/* CPU */
start=0;
getsysinfo(GSI_CPU_INFO, &cpu, sizeof(cpu), &start);
start=0;
getsysinfo(GSI_PROC_TYPE, &proc_type, sizeof(proc_type), &start);
proc_type&=0x0000ffff;
CPU_TYPE_TO_TEXT(proc_type, cpu_name);
printf("CPUs \t %d\n"
"CPU-type\t %s\n"
"Speed \t %d MHz\n",
cpu.cpus_in_box, cpu_name, normalize(cpu.mhz, CPU));
/* Memory */
start=0;
getsysinfo(GSI_PHYSMEM, buffer, sizeof(buffer), &start);
printf("Memory\t\t %d MB\n", normalize(((int) *buffer) >>10,MEM) );
/* Graphics */
start=0;
getsysinfo(GSI_GRAPHICTYPE, buffer, sizeof(buffer), &start);
buffer[8]=0;
start=0;
getsysinfo(GSI_GRAPHIC_RES, &res_buffer, sizeof(res_buffer), &start);
if (res_buffer.width!=0) /* Maybe no graphics at all */
printf("Graphics\t %s (%dx%d)\n",
buffer, res_buffer.width, res_buffer.height);
/* More Graphics ? */
while (start)
{
prev_start=start;
getsysinfo(GSI_GRAPHICTYPE, buffer, sizeof(buffer), &start);
buffer[8]=0;
printf("Graphics\t %s", buffer);
getsysinfo(GSI_GRAPHIC_RES, &res_buffer, sizeof(res_buffer), &prev_start);
printf(" (%dx%d)\n", res_buffer.width, res_buffer.height);
}
/* System disk */
start=0;
getsysinfo(GSI_BOOTDEV, buffer, sizeof(buffer), &start);
printf("boot device\t %s\n", buffer);
/* If command line optins were given, these are prom-variables to be asked */
for (env=1; env<argc; env++)
{
start=0;
if ( getsysinfo(GSI_PROM_ENV, buffer, sizeof(buffer), &start, argv[env])
!=-1)
printf("%s\t %s\n", argv[env], buffer);
else
printf("%s\t Not in PROM\n", argv[env]);
}
}
/* End of sysinfo.c */
Bye,
Wolfram
--
"""
(o o)
+---------------------------------oOO--(_)--OOo-------------------------------+
| Wolfram Klaus (klaus@physik.fu-berlin.de) FU Berlin, FB Physik |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: finding sys info, processor bits, mem size, etc
1999-07-15 4:00 finding sys info, processor bits, mem size, etc Erik Lindberg
1999-07-16 4:00 ` Wolfram Klaus
@ 1999-07-17 4:00 ` Adam Price
1999-07-23 4:00 ` Stuart R. Fuller
2 siblings, 0 replies; 4+ messages in thread
From: Adam Price @ 1999-07-17 4:00 UTC (permalink / raw)
Erik Lindberg wrote in message
<378E27A5.B71A6E1D@roguewave.com>...
>Im looking for ways to find various DEC sys info such as
physical memory
>size, number of processors, etc, hopefully in the form of one or
more
>clever unix commands (like hinv for SGI) or utility scripts.
Got any
>ideas?
>Thanks
>
Look for sys_check, if your version of Tru64 is modern (4.0e + I
think) then it ships with the OS, if not it can be downloaded
from Dec^w Compaq.
Hope this helps
Adam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: finding sys info, processor bits, mem size, etc
1999-07-15 4:00 finding sys info, processor bits, mem size, etc Erik Lindberg
1999-07-16 4:00 ` Wolfram Klaus
1999-07-17 4:00 ` Adam Price
@ 1999-07-23 4:00 ` Stuart R. Fuller
2 siblings, 0 replies; 4+ messages in thread
From: Stuart R. Fuller @ 1999-07-23 4:00 UTC (permalink / raw)
Erik Lindberg (lindberg@roguewave.com) wrote:
: Im looking for ways to find various DEC sys info such as physical memory
: size, number of processors, etc, hopefully in the form of one or more
: clever unix commands (like hinv for SGI) or utility scripts. Got any
: ideas?
Since you mentioned "unix", I'll assume that you're asking in the context of
Digital Unix or Tru64 Unix.
When Digital/Tru64 Unix boots, it displays a hardware inventory of everything
that the kernel is built for and what it actually saw. The memory size,
number (and speed) of processors are all there. Use this command to view the
inventory from the error log:
# uerf -Rr 300 | more
Stu
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-07-23 4:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-15 4:00 finding sys info, processor bits, mem size, etc Erik Lindberg
1999-07-16 4:00 ` Wolfram Klaus
1999-07-17 4:00 ` Adam Price
1999-07-23 4:00 ` Stuart R. Fuller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox