From: Rob Hooft <Rob.Hooft@embl-heidelberg.de>
Subject: Re: Way to show RAM size from shell?
Date: 1996/08/14 [thread overview]
Message-ID: <vzyu3u6mggd.fsf@nu.embl-heidelberg.de> (raw)
In-Reply-To: 4uo0lp$g3s@news.alaska.edu
>>>>> "RMH" == Randy M Hayman <haymanr@icefog.alaska.edu> writes:
RMH> take the following, compile it (cc -o physmem physmem.c), and
RMH> place the executable in your path:
Based on that program I hacked together a somewhat more complete hardware
report. Obviously not tested in all possible configurations. Enjoy.
[Phil Farrell <farrell@pangea.Stanford.EDU> reported a bug in version
1.0 which I posted yesterday. It could not be compiled on pre-DU4.0
boxes. Therefore here version 1.1. Comments welcome.]
------------------------------------------------------------------------------
/* hinv.c: based on a news-post by Randy M. Hayman (haymanr@icefog.alaska.edu)
*
* Hacked by Rob Hooft (hooft@embl-heidelberg.de). Version 1.1, Aug 14, 1996
*
* (C) 1996 Rob Hooft, EMBL. Distribute freely.
*/
#include <stdio.h>
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
#include <machine/cpuconf.h>
#define debug(x) /* printf(x) */
/*
* Some return buffers for different calls
*/
int status, int_buff, start;
#if defined(GSI_CPU_INFO) /* 3.x onwards? */
struct cpu_info buf;
#endif
struct { int width, height; } resbuf;
char gratype[9];
char hw[100];
long long_buf;
char *procid;
/*
* CPU Id strings
*/
char *cpustr[]={
/* 0 */ "UNKN_SYSTEM",
/* 1 */ "VAX_780",
/* 2 */ "VAX_750",
/* 3 */ "VAX_730",
/* 4 */ "VAX_8600",
/* 5 */ "VAX_8200",
/* 6 */ "VAX_8800",
/* 7 */ "MVAX_I",
/* 8 */ "MVAX_II",
/* 9 */ "V_VAX Virtual VAX",
/* 10 */ "VAX_3600 Mayfair I",
/* 11 */ "VAX_6200 CVAX/Calypso",
/* 12 */ "VAX_3400 Mayfair II",
/* 13 */ "C_VAXSTAR VAX3100 (PVAX)",
/* 14 */ "VAX_60 Firefox",
/* 15 */ "VAX_3900 Mayfair III",
/* 16 */ "DS_3100 DECstation 3100 (PMAX)",
/* 17 */ "VAX_8820 Polarstar",
/* 18 */ "DS_5400 MIPSfair",
/* 19 */ "DS_5800 ISIS",
/* 20 */ "DS_5000 3MAX",
/* 21 */ "DS_CMAX",
/* 22 */ "VAX_6400 RIGEL/Calypso",
/* 23 */ "VAXSTAR",
/* 24 */ "DS_5500 MIPSFAIR-2",
/* 25 */ "DS_5100 MIPSMATE",
/* 26 */ "VAX_9000",
/* 27 */ "DS_5000_100 3MIN",
/* 28 */ "ALPHA_ADU",
/* 29 */ "DEC_4000 Cobra",
/* 30 */ "DEC_3000_500 Flamingo workstation",
/* 31 */ "DEC_7000 EV4 on Lazer platform",
/* 32 */ "DS_5000_300 3MAX+/BIGMAX",
/* 33 */ "DEC_3000_300 Pelican workstation",
/* 34 */ "DEC_2000_300 Jensen Alpha PC",
/* 35 */ "DEC_2100_A500 Sable",
/* 36 */ "LCA_MUSTANG Mustang Desktop PC",
/* 37 */ "DEC_2100_A50 Avanti Alpha PC system",
/* 38 */ "ALPHA_KN20AA kn20aa workstation",
/* 39 */ "DEC_21000 TurboLaser",
/* 40 */ "DEC_AXPVME_64 Medulla",
/* 41 */ "DEC_2100_C500 Gamma",
/* 42 */ "DEC_AXPPCI_33",
/* 43 */ "DEC_1000 Mikasa APS Server",
/* 44 */ "EB64_PLUS EB64+ Evaluation Board",
/* 45 */ "LCA_EB66 EB66 Evaluation Board",
/* 46 */ "ALPHA_EB164 EB164 Evaluation Board",
/* 47 */ "Unrecognized",
/* 48 */ "Noritake",
};
#if CPU_MAX>48
#error Please check list of cpu names in /usr/include/machine/hal/cpuconf.h
#endif
int main()
{
#if defined(GSI_PLATFORM_NAME)
if (getsysinfo(GSI_PLATFORM_NAME,(caddr_t)hw,sizeof(hw),0,0)<0) {
debug("O/S might be too old to get platform name\n");
} else {
printf("Platform name : %s\n", hw);
}
#endif
#if defined(GSI_PHYSMEM)
if (getsysinfo(GSI_PHYSMEM,(caddr_t)&int_buff,sizeof(int_buff),0,0)<0) {
debug("error getting GSI_PHYSMEM\n");
} else {
printf("Physical memory : %7d kB\n", int_buff);
}
#endif
#if defined(GSI_PROC_TYPE)
if (getsysinfo(GSI_PROC_TYPE,(caddr_t)&long_buf,sizeof(long_buf),0,0)<0) {
debug("O/S might be too old to get processor type\n");
} else {
long_buf&=0xffffffff;
#if defined(CPU_TYPE_TO_TEXT)
CPU_TYPE_TO_TEXT(long_buf,procid);
printf("Processor type : %7ld [%s]\n", long_buf,procid);
#else
printf("Processor type : %7ld\n", long_buf);
#endif
}
#endif
#if defined(GSI_CPU_INFO)
if (getsysinfo(GSI_CPU_INFO,(caddr_t)&buf,sizeof(buf),0,0)<0) {
debug("O/S might be too old to ask for CPU info\n");
#endif
if (getsysinfo(GSI_CPU,(caddr_t)&int_buff,sizeof(int_buff),0,0)<0) {
debug("Error getting GSI_CPU\n");
} else {
printf("CPU type : %7d [%s]\n", int_buff, cpustr[int_buff]);
}
#if defined(GSI_CPUS_IN_BOX)
if (getsysinfo(GSI_CPUS_IN_BOX,(caddr_t)&int_buff,sizeof(int_buff),0,0)<0) {
debug("O/S might be too old to get # of CPU's in box\n");
} else {
printf("CPU's in box : %7d\n", int_buff);
}
#endif
#if defined(GSI_CPU_INFO)
} else {
printf("Current CPU : %7d\n", buf.current_cpu);
printf("CPU's in box : %7d\n", buf.cpus_in_box);
printf("CPU type : %7d [%s]\n", buf.cpu_type, cpustr[buf.cpu_type]);
#if defined(GSI_PLATFORM_NAME) /* Dirty hack: how do I detect 4.0? */
if (buf.mhz>1000 || buf.mhz<10) {
debug("O/S might be too old to ask for CPU clock\n"); /* pre-4.0? */
} else {
printf("CPU speed : %7d MHz\n",buf.mhz); /* 4.0 onwards? */
}
#endif
}
#endif
#if defined(GSI_CLK_TCK)
if (getsysinfo(GSI_CLK_TCK,(caddr_t)&int_buff,sizeof(int_buff),0,0)<0) {
debug("error getting GSI_CLK_TCK\n");
} else {
printf("Time slices : %7d Hz\n", int_buff);
}
#endif
#if defined(GSI_GRAPHICTYPE)
start=0;
while (1) {
if(getsysinfo(GSI_GRAPHICTYPE,(caddr_t)gratype,sizeof(gratype),&start,0)<0) {
debug("O/S might be too old to get graphic type\n");
} else {
if (start<0) break;
gratype[8]=0;
printf("Graphic type [unit %d]: %s\n", start,gratype);
}
if (!start) break;
}
#endif
#if defined(GSI_GRAPHIC_RES)
start=0;
while (1) {
if(getsysinfo(GSI_GRAPHIC_RES,(caddr_t)&resbuf,sizeof(resbuf),&start,0)<0) {
debug("O/S might be too old to get graphic resolution\n");
} else {
if (start<0) break;
printf("Graphic res [unit %d]: %dx%d\n", start,resbuf.width,resbuf.height);
}
if (!start) break;
}
#endif
return 0;
}
next prev parent reply other threads:[~1996-08-14 4:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-08-08 4:00 Way to show RAM size from shell? Daniel Hillman
1996-08-09 4:00 ` Stephen Stuart
1996-08-10 4:00 ` Michael Rutter
1996-08-14 4:00 ` Jonathan Oei
1996-08-10 4:00 ` A. Suleiman
1996-08-13 4:00 ` Paul Henderson
1996-08-12 4:00 ` Daniel Lewis
1996-08-19 4:00 ` J. Shane Kennedy
1996-08-12 4:00 ` Randy M. Hayman
1996-08-13 4:00 ` Rob Hooft
1996-08-14 4:00 ` Rob Hooft [this message]
1996-08-14 4:00 ` Freely Available Software (Digital UNIX) Randy M. Hayman
1996-08-14 4:00 ` Way to show RAM size from shell? Chi Xiaochen
1996-08-14 4:00 ` Dan Pop
1996-08-15 4:00 ` Alan Rollow - Dr. File System's Home for Wayward Inodes.
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox