[292] in NetBSD-Development
Re: short questions related to olc
daemon@ATHENA.MIT.EDU (Greg Hudson)
Wed Dec 21 03:00:32 1994
To: yoav@MIT.EDU
Cc: netbsd-dev@MIT.EDU
In-Reply-To: Your message of "Wed, 21 Dec 1994 02:18:14 EST."
<199412210718.CAA10763@lola-granola.MIT.EDU>
Date: Wed, 21 Dec 1994 03:00:06 EST
From: Greg Hudson <ghudson@MIT.EDU>
> how does one find out:
Here I give shell commands in most cases, and some methods for C code.
The shell commands should work in both sh and csh. Naturally, you can
use popen("shell command", "r") in C code to get the output of a shell
command.
> a) what kind of display are you using (as informative a one-liner as
> possible/)
echo \
`xdpyinfo | grep "name of display" | head -1 | awk '{print $4;}'` \
"("`xdpyinfo | grep dimensions | head -1 | awk '{print $2;}'`"," \
`xdpyinfo | grep "depth of root window" | head -1 | awk '{print $5;}'` \
"bit planes)"
Produces, e.g.:
glacier:0.0 (1024x768, 8 bit planes)
> b) how much memory (swap, ram, and free) you have - one linesr
To get total, used, and available swap on swap devices in 512-byte
blocks:
/usr/sbin/pstat -s | /usr/bin/tail +2 | /usr/bin/awk '{sum += $2; used += $3; avail += $4;} END { print sum, used, avail; }'
I don't know whether in NetBSD your total swap space is the amount you
allocated on disk, or that plus physical memory, but this only reports
the amount of swap space used on swap devices (disk).
Physical memory (three methods):
(a) sysctl -n hw.physmem
(b) expr `cat /kern/pagesize` \* `cat /kern/physmem`
(c) In C,
#include <sys/sysctl.h>
int ctl[2] = { CTL_HW, HW_PHYSMEM }, mem;
sysctl(ctl, 2, &mem, sizeof(int), NULL, 0);
> c) which versions (I assume /kern/something will do that)
/kern/version has two versions, the first of which is relevant.
"uname -r" or sysctl()