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
CPUSET(3)						   BSD Library Functions Manual 						 CPUSET(3)

NAME
cpuset_create, cpuset_destroy, cpuset_zero, cpuset_set, cpuset_clr, cpuset_isset, cpuset_size -- dynamic CPU sets SYNOPSIS
#include <sched.h> cpuset_t * cpuset_create(void); void cpuset_destroy(cpuset_t *set); void cpuset_zero(cpuset_t *set); int cpuset_set(cpuid_t cpu, cpuset_t *set); int cpuset_clr(cpuid_t cpu, cpuset_t *set); int cpuset_isset(cpuid_t cpu, const cpuset_t *set); size_t cpuset_size(const cpuset_t *set); DESCRIPTION
This section describes the functions used to create, set, use and destroy the dynamic CPU sets. This API can be used with the POSIX threads, see pthread(3) and affinity(3). The ID of the primary CPU in the system is 0. FUNCTIONS
cpuset_create() Allocates and initializes a clean CPU-set. Returns the pointer to the CPU-set, or NULL on failure. cpuset_destroy(set) Destroy the CPU-set specified by set. cpuset_zero(set) Makes the CPU-set specified by set clean, that is, memory is initialized to zero bytes, and none of the CPUs set. cpuset_set(cpu, set) Sets the CPU specified by cpu in set. Returns zero on success, and -1 if cpu is invalid. cpuset_clr(cpu, set) Clears the CPU specified by cpu in the CPU-set set. Returns zero on success, and -1 if cpu is invalid. cpuset_isset(cpu, set) Checks if CPU specified by cpu is set in the CPU-set set. Returns the positive number if set, zero if not set, and -1 if cpu is invalid. cpuset_size(set) Returns the size in bytes of CPU-set specified by set. SEE ALSO
affinity(3), pset(3), sched(3), schedctl(8), kcpuset(9) HISTORY
The dynamic CPU sets appeared in NetBSD 5.0. BSD
November 2, 2011 BSD
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy