Sponsored Content
Top Forums UNIX for Advanced & Expert Users What's the easiest way to display system cpu, memory, # drives/size ?? Post 17209 by AtleRamsli on Tuesday 12th of March 2002 07:31:57 AM
Old 03-12-2002
There you probably have the only real way to do it.
I have never seen that SunOS stuff on any other system, and if I should vote between that and GNU /proc, I'd vote for the latter.

But in dmesg you find what the system found, and dmesg is on all systems I know about.

Could you tell us what you want this information for?

These are the commands I found that deal with some of this:

uname - Will tell you about the system name
top - You may parse some of this stuff and
draw inferences from it
df - This tells you about drives and free
space (parse for NFS mounts!)

To determine system speed, you have to make a small program, I guess.
Time a loop or something, maybe invalidate the cache inside the loop, determine what you want as criterion, and divide that by the time it took to run.

double d, dd;
long i;
long t = (long)time();
d = (double) t;
 for (i=0; i < LOOPCNTR; i++)
invalidate_cache();
t = (long) time();
dd = (double) t;

time_it_took = dd - d;

system_speed = criterion / time_it_took;

You could fork one for each 'suspected' process and time it again. With a few if's - like each new process is given a new processor, you may infer the number of processor by multiplying time_it_took by the number of forks and compare.

This is a BFAMI(*) approach that might work.

Physical memry can be determined with a

long *p = 0;
while(p++);

loop that evenually will seqfault.
Trap that, and check the count.
Another BFAMI approach.

A structured approach is write to the POSIX guys and tell them: "Hey, I think we need a portable way of determining the system configuration, like CPUs, memory, disks, etc."

Maybe they'll listen.

Write an RFC.

Pray.

Atle



(*)(BFAMI = brute-force-and-massive-ignorance)
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Clearify what it means under 'WHAT' when hit the 'w'-command

I wonder how I shall read the result below, especially 'what' shown below. The result was shown when I entered 'w'. E.g what is TOP? What is gosh ( what does selmgr mean?)? login@ idle JCPU PCPU what 6:15am 7:04 39 39 TOP 6:34am 6:45 45 45 TOP 6:41am ... (1 Reply)
Discussion started by: Aelgen
1 Replies

2. UNIX for Dummies Questions & Answers

CPU's

I have a question. Is Linux (Redhat 7.2 specifically) set up to run better/faster on a Pentium cpu vs. an AMD? The reason I ask is, I have a PIII 733 w/512 pc133, and a 4mb video card at work, and an AMD 1.4 w/1gb ddr, and a Radeon 64mb DDR at home, and the PIII at work runs a lot faster. I have a... (1 Reply)
Discussion started by: jeremiebarber
1 Replies

3. UNIX for Advanced & Expert Users

memory free up using 'find'

Hi, I am facing an interesting aspect of find command... to be clear, we are running a small web server with oracle 8i database and Oralce9iAS on Sun E250 with Solaris 2.6 Over a period of time, the free memory ( displayed in 'top' utility ) drops down.. we could relate this to dedicated... (6 Replies)
Discussion started by: shibz
6 Replies

4. AIX

command to display my tape drives (rmt's)

Hi all, Looking for an ls** command to display my tape drives and their associated serial numbers. thx. (8 Replies)
Discussion started by: jwholey
8 Replies

5. Programming

How can I get a processor's CPU Percentage?

you know that.. in HP-UX.. in sys/pstat.h struct pst_status { long pst_idx; /* Index for further pstat() requests */ long pst_uid; /* Real UID */ long pst_pid; /* Process ID */ .... float pst_pctcpu; /* %cpu for this process during p_time... (3 Replies)
Discussion started by: sangjinn
3 Replies

6. UNIX for Dummies Questions & Answers

cpu, memory and virtual memory usage

Hi All, Does anyone know what the best commands in the UNIX command line are for obtaining this info: current CPU usage memory usage virtual memory usage preferably with date and time parameters too? thanks ocelot (4 Replies)
Discussion started by: ocelot
4 Replies

7. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

8. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

9. Solaris

Memory or CPU size

Is there a command or file I can look at that tells me how much real memory a machine has? A little background. In my shop we run a bunch of java programs, sometimes some of these jobs have config definitions that call for 2G. I would like to know how many I can run before I exhaust rescources. Any... (12 Replies)
Discussion started by: Harleyrci
12 Replies
J0(3)							     Linux Programmer's Manual							     J0(3)

NAME
j0, j0f, j0l, j1, j1f, j1l, jn, jnf, jnl, y0, y0f, y0l, y1, y1f, y1l, yn, ynf, ynl - Bessel functions SYNOPSIS
#include <math.h> double j0(double x); double j1(double x); double jn(int n, double x); double y0(double x); double y1(double x); double yn(int n, double x); float j0f(float x); float j1f(float x); float jnf(int n, float x); float y0f(float x); float y1f(float x); float ynf(int n, float x); long double j0l(long double x); long double j1l(long double x); long double jnl(int n, long double x); long double y0l(long double x); long double y1l(long double x); long double ynl(int n, long double x); DESCRIPTION
The j0() and j1() functions return Bessel functions of x of the first kind of orders 0 and 1, respectively. The jn() function returns the Bessel function of x of the first kind of order n. The y0() and y1() functions return Bessel functions of x of the second kind of orders 0 and 1, respectively. The yn() function returns the Bessel function of x of the second kind of order n. For the functions y0(), y1() and yn(), the value of x must be positive. For negative values of x, these functions return -HUGE_VAL. The j0f() etc. and j0l() etc. functions are versions that take and return float and long double values, respectively. CONFORMING TO
The functions returning double conform to SVID 3, BSD 4.3, XPG4, POSIX 1003.1-2001. The other functions exist by analogy, and exist on sev- eral platforms. BUGS
There are errors of up to 2e-16 in the values returned by j0(), j1() and jn() for values of x between -8 and 8. 2002-08-25 J0(3)
All times are GMT -4. The time now is 07:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy