Finding CPU & Memory info on BSD box?

Armitage

Banned
Feb 23, 2001
8,086
0
0
Ok, on a Linux box I'd just use:

cat /proc/cpuinfo
free

What's the equivalent on a BSD box to get information on the CPU(s) and memory?
Thanks
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
There isn't one, use dmesg.

EDIT: duh, which BSD? FreeBSD has a /proc, look there. NetBSD required BBWF to get in here and answer. OpenBSD disabled /proc by default, but dmesg has that information.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
It's FreeBSD, which has a /proc but no cpuinfo in there.
But yea, I found what I needed in dmesg. Thanks.

dmesg is pretty fugly to parse though :(

 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: ergeorge
It's FreeBSD, which has a /proc but no cpuinfo in there.
But yea, I found what I needed in dmesg. Thanks.

dmesg is pretty fugly to parse though :(

Uglier than adding to /proc kernel code?
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Try vmstat (lots of options for it too), sysstat, tons of other little utils that I can't recall/don't know. dmesg isn't too bad to parse, It was my first python project.

edit: If you don't want live usage info, but just info about the hardware itself/how much you have/etc, then yeah, dmesg is the way to go.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
Originally posted by: n0cmonkey
Originally posted by: ergeorge
It's FreeBSD, which has a /proc but no cpuinfo in there.
But yea, I found what I needed in dmesg. Thanks.

dmesg is pretty fugly to parse though :(

Uglier than adding to /proc kernel code?

?? Not sure what you mean by that ??

In any case, I'm thinking I need to drop this bit anyway. I have a distributed program where the slaves would report back the speed of the cpu they were running on so the master process could make an initial hack at load balancing. But it's getting used on to many different platforms (Linux, BSD, SGI, maybe Sun) and everybody does that bit differently, and it doesn't take into account system load anyway.

Besides, after the first cycle, it balances the load dynamically based on the actual runtimes on the previous cycle. When I had a small cluster of various speed machines it was nice for debugging (so you aren't waiting on the slow machines to get through a cycle). But now I have a real cluster that's largely homogeneous and much faster that I develop on :D So it's not worth the trouble to maintain it.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
/proc may not be the best solution (I think it's been moved to sysfs or something in 2.5) but it's got a lot of information that's just a pain to coax out of BSD. What happens when the kernel log wraps around and dmesg is filled with other messages (I get 2 arp replacement messages periodically because of how my ISP is setup)?

The lack of a 'free' command is also annoying.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: Nothinman
What happens when the kernel log wraps around and dmesg is filled with other messages
cat /var/run/dmesg.out (on netbsd at least)

(I get 2 arp replacement messages periodically because of how my ISP is setup)?
Heh, I get those too, very annoying.

The lack of a 'free' command is also annoying.
I believe vmstat under memory/avm is the number of used pages, divide it by 1024 and that's your mem usage in MB (same number as "act" in top), but I'm not 100% sure because 138MB seems a bit high to me (no gui, etc).