From owner-freebsd-hackers Mon Oct 6 05:58:31 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id FAA26068 for hackers-outgoing; Mon, 6 Oct 1997 05:58:31 -0700 (PDT) (envelope-from owner-freebsd-hackers) Received: from konig.elte.hu (konig.elte.hu [157.181.6.22]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id FAA26062 for ; Mon, 6 Oct 1997 05:58:24 -0700 (PDT) (envelope-from sebesty@cs.elte.hu) Received: from neumann.cs.elte.hu (neumann [157.181.6.200]) by konig.elte.hu (8.8.3/8.7.3/7s) with ESMTP id OAA10816; Mon, 6 Oct 1997 14:58:00 +0200 Received: from localhost (sebesty@localhost) by neumann.cs.elte.hu (8.8.3/8.7.3/4c) with SMTP id OAA14013; Mon, 6 Oct 1997 14:58:22 +0200 X-Authentication-Warning: neumann.cs.elte.hu: sebesty owned process doing -bs Date: Mon, 6 Oct 1997 14:58:22 +0200 (MET DST) From: Zoltan Sebestyen To: Mike Smith cc: FreeBSD hackers mailinglist Subject: Re: cpu/memory monitoring In-Reply-To: <199710060857.SAA01151@word.smith.net.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Mon, 6 Oct 1997, Mike Smith wrote: > > Hmm, the reason I asked for a simpler source than top's one is that I'm > > porting an application that behaves like Win NT's taskmanager. It was > > For those of us that don't know what NT's taskmanager actually looks > like, can you perhaps elaborate as to what your actual requirements are? > > If all you want is the CPU load average, the function getloadavg() > should be all that you need. FreeBSD doesn't have such a thing as > "free" memory, as unused memory is occupied by the buffer cache. You > can look at the source for 'systat' for how to extract that sort of > information. > > mike > Hi, The application I'm porting was written on Linux and has nothing to do with NT's taskmanager except for its look. It displays the "user", "nice" "system" cpuload and it get their actual state from /proc/stat and DOESN'T transform them to any 'dumb' form. On FreeBSD you can get these pieces of information from the kernel memory the the kvm API(A couple of functions, their names start with 'kvm_') Top is an excellent example on how to get them, but its source code is a bit complex, that's why I asked for a program with simpler code. I dealt with getloadavg() for a while, but it gives not that kind of information I wanted. -------------------------------------------------------------------------------- Sebestyen Zoltan It all seems so stupid, it makes me want to give up. szoli@caesar.elte.hu But why should I give up, when it all seems so stupid?