Hi, On Wed, Jun 05, 2002 at 09:55:42PM +0200, [EMAIL PROTECTED] wrote: > Hi friends, > > Which system calls can provide me detailed information (structures is preferable) on >RedHat 7.2 regarding: > > 1. Memory usage (similar to the info inculded in /proc/meminfo) > 2. CPU usage (SMP configuration - both CPUs, similar to the info we can get from >"gtop")
Simply go ahead and read /proc/*. This is _the_ interface. Read sysctl(2). For documentation on /proc, read /usr/src/linux/Documentation/filesystems/proc.txt or (the much outdated) man proc(5). If you want some of the information to be gathered for you, download the sources of procps and check the ./proc subdir. It might save you some work. Note, that traditionally, Unix didn't offer interfaces to such info. E.g., in most Unixen (at least older ones), writing ps(1) by yourself involves reading directly the memory of the kernel, and parsing it according to the symbol table of the kernel executable /vmunix, with a function named nlist, similar to gnu bfd (part of gnu binutils). If you want to see an example, look at the sources of the original top (not from procps), e.g. from <http://www.groupsys.com>. Believe me, reading /proc is a lot easier. > 3. Disk usage - "statfs" is very good - so it's a reference to which kind of info I >expect from 1 & 2. > > Thanks, > Avi > Didi ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
