From b05cfacb3d214d5d9d06df91c48e7cd5dbbaa844 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 12 Aug 1998 16:25:48 +0000 Subject: [PATCH] New directory. Updated documentation. 1998-08-12 Martin Baulig * features: New directory. * gnome-hackers.sgml: Updated documentation. --- doc/ChangeLog | 5 ++ doc/Makefile | 4 +- doc/features/proclist.sgml | 153 +++++++++++++++++++++++++++++++++++++ doc/features/procmem.sgml | 103 +++++++++++++++++++++++++ doc/features/uptime.sgml | 23 ++++++ doc/features/uptime.txt | 40 ++++++++++ doc/gnome-hackers.sgml | 42 ++++++++-- 7 files changed, 364 insertions(+), 6 deletions(-) create mode 100644 doc/features/proclist.sgml create mode 100644 doc/features/procmem.sgml create mode 100644 doc/features/uptime.sgml create mode 100644 doc/features/uptime.txt diff --git a/doc/ChangeLog b/doc/ChangeLog index 635d9616..378ea7cf 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +1998-08-12 Martin Baulig + + * features: New directory. + * gnome-hackers.sgml: Updated documentation. + 1998-08-11 Martin Baulig * gnome-hackers.sgml: Updated documentation. diff --git a/doc/Makefile b/doc/Makefile index b95a67c6..00c09935 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -12,7 +12,9 @@ clean: -V %no-make-index% libgtop.sgml > /dev/null && \ touch .timestamp -.timestamp2: gnome-hackers.sgml autoconf.sgml ../guile/reference.sgml +.timestamp2: gnome-hackers.sgml autoconf.sgml ../guile/reference.sgml \ + features/uptime.sgml features/uptime.txt features/proclist.sgml \ + features/procmem.sgml -rm -rf gnome-hackers mkdir gnome-hackers -rm -f .timestamp2 diff --git a/doc/features/proclist.sgml b/doc/features/proclist.sgml new file mode 100644 index 00000000..d071a758 --- /dev/null +++ b/doc/features/proclist.sgml @@ -0,0 +1,153 @@ + + This functions takes the following additional parameters: + + + + which + + + + You can use the following constants (defined in + glibtop/proclist.h) to tell + glibtop_get_proclist () which processes + to fetch: + + + + GLIBTOP_KERN_PROC_ALL + + + + Fetch all processes. + + + + + GLIBTOP_KERN_PROC_PID + + + + Fetch process with pid arg or + nothing if no such process exists. + + + + + GLIBTOP_KERN_PROC_PGRP + + + + Fetch only processes which are in process group + arg. + + + + + GLIBTOP_KERN_PROC_SESSION + + + + Fetch only processes with session id + arg. + + + + + GLIBTOP_KERN_PROC_TTY + + + + Fetch only processes with tty id + arg. + + + + + GLIBTOP_KERN_PROC_UID + + + + Fetch only processes with effective user id + arg. + + + + + GLIBTOP_KERN_PROC_RUID + + + + Fetch only processes with real user id + arg. + + + + + + + You can use one or more of the following flags (with a + logical or) to hide some processes: + + + + GLIBTOP_EXCLUDE_IDLE + + + + Don't fetch idle processes. + + + + + GLIBTOP_EXCLUDE_SYSTEM + + + + Don't fetch system processes. + + + + + GLIBTOP_EXCLUDE_NOTTY + + + + Don't fetch processes that have no controlling tty. + + + + + + + + + arg + + + + Additional argument depending upon the + which argument. + + + + + + This function returns a pointer (of type unsigned *) to + the list of process ids. + + + You have to manually &glibtop-free; this pointer once finished with it. + + + \ No newline at end of file diff --git a/doc/features/procmem.sgml b/doc/features/procmem.sgml new file mode 100644 index 00000000..3394afba --- /dev/null +++ b/doc/features/procmem.sgml @@ -0,0 +1,103 @@ + + The automatically generated description above is taken from the + manual page of the /proc filesystem under Linux + and is a little bit confusing, so I make this clear here. + + + Note for people porting &libgtop; to other systems + + + Well, every operating system has its own idea about the memory usage + of a processes, and also system utilities like ps + show different things on different systems. + + + Nevertheless, we should try to make &libgtop; as system independent + as possible, so I give you some hints here how &glibtop-get-procmem; + should work. + + + + + When you use &mmap; with either &MAP-SHARED; or &MAP-PRIVATE;, + this should only affect the &pmem-vsize; of the process and + none of its &pmem-size;, &pmem-resident;, &pmem-shared; and + &pmem-rss; sizes. + + + + As soon as you read some of the &mmap;ed pages, they will be + demand-loaded and thus count towards the &pmem-size; of the + process. Also - we assume there is enough free memory - they + are resident in memory until they get stolen or swapped out + and thus increase the &pmem-resident; and &pmem-rss; sizes of + the process. + + + + If the process has used &MAP-SHARED; and another process + attaches the same file also &MAP-SHARED; some of the pages + are shared with this process and thus increase the &pmem-shared; + sizes of both processes. + + + + If the process has used &MAP-PRIVATE; and writes to the &mmap;ed + pages, the only difference to reading from them is that they + get dirty and cannot be stolen any longer but will get swapped + out. + + + + If memory gets rare, clean pages are normally stolen which + decreases the &pmem-size;, &pmem-resident;, &pmem-shared; and + &pmem-rss; sizes of the process. + + + + When dirty pages are swapped out, this will + not decrease the &pmem-size; of the + process but only its &pmem-resident; and &pmem-rss; sizes + (dirty pages cannot be shared). + + + + The &pmem-vsize; of a process can only + be changed by the process itself when it requests or frees + memory but never due to swapping + activity of the system. + + + + If the &pmem-shared; size changes, this + only means that the number of pages that + are currently shared with other processes has changed; if this + happens, this will never affect any of the + other sizes of the process. + + + + + + + The hints above describe how it works under Linux - and we should try to + make &glibtop-get-procmem; show the same behavior under every other + system. + + + If you want to make any comments, flames, suggestions about this, please + feel free to do so. + + + \ No newline at end of file diff --git a/doc/features/uptime.sgml b/doc/features/uptime.sgml new file mode 100644 index 00000000..ea504b6a --- /dev/null +++ b/doc/features/uptime.sgml @@ -0,0 +1,23 @@ + + + + You can calculate this from the CPU usage (this one is taken + from the FreeBSD port): + + &include-uptime.txt; + + + + + \ No newline at end of file diff --git a/doc/features/uptime.txt b/doc/features/uptime.txt new file mode 100644 index 00000000..be3f4489 --- /dev/null +++ b/doc/features/uptime.txt @@ -0,0 +1,40 @@ +#include <glibtop.h> +#include <glibtop/error.h> +#include <glibtop/uptime.h> + +#include <glibtop/cpu.h> + +#include <glibtop_suid.h> + +static const unsigned long _glibtop_sysdeps_uptime = +(1 << GLIBTOP_UPTIME_UPTIME) + (1 << GLIBTOP_UPTIME_IDLETIME); + +static const unsigned long _required_cpu_flags = +(1 << GLIBTOP_CPU_TOTAL) + (1 << GLIBTOP_CPU_IDLE) + +(1 << GLIBTOP_CPU_FREQUENCY); + +void +glibtop_get_uptime_p (glibtop *server, glibtop_uptime *buf) +{ + glibtop_cpu cpu; + + glibtop_init_p (server, GLIBTOP_SYSDEPS_UPTIME, 0); + + memset (buf, 0, sizeof (glibtop_uptime)); + + /* We simply calculate it from the CPU usage. */ + + glibtop_get_cpu_p (server, &cpu); + + /* Make sure all required fields are present. */ + + if ((cpu.flags & _required_cpu_flags) != _required_cpu_flags) + return; + + /* Calculate values. */ + + buf->uptime = (double) cpu.total / (double) cpu.frequency; + buf->idletime = (double) cpu.idle / (double) cpu.frequency; + + buf->flags = _glibtop_sysdeps_uptime; +} diff --git a/doc/gnome-hackers.sgml b/doc/gnome-hackers.sgml index 474dde8a..9b0b03a4 100644 --- a/doc/gnome-hackers.sgml +++ b/doc/gnome-hackers.sgml @@ -9,10 +9,20 @@ libgtop"> - + macros/gnome-libgtop-check.m4"> libgtopConf.sh"> +glibtop_free ()"> +glibtop_get_proc_mem ()"> +mmap ()"> +MAP_SHARED"> +MAP_PRIVATE"> +procmem.vsize"> +procmem.size"> +procmem.resident"> +procmem.shared"> +procmem.rss"> @@ -30,15 +40,15 @@ - + - + - + @@ -46,6 +56,8 @@ + + ]> @@ -139,7 +151,27 @@ &include-reference.sgml; - + + + Porting &libgtop; to other systems + + + Here are some comments for people porting &libgtop; to other systems. + + + &glibtop-get-procmem; - Process Memory information + + + This section is copied here from the description of + &glibtop-get-procmem;. + + + &include-proc-mem.sgml; + + + + +