Using text_rss', shlib_rss', data_rss' and dirty_size' instead of

1998-08-12  Martin Baulig  <martin@home-of-linux.org>

	* include/glibtop/procsegment.h (glibtop_proc_segment): Using
	`text_rss', `shlib_rss', `data_rss' and `dirty_size' instead of
	`tsr', `lrs', `drs' and `dt'. New field `stack_rss'.

	* sysdeps/linux/procmem.c: Memory sizes now correctly in bytes.
	* sysdeps/linux/procsegment.c: Dito.

	* sysdeps/kernel/procsegment.c: Stack pages are reported via
	`stack_rss' and no longer count towards `data_rss'
	* kernel/table.h (table_proc_segment): Added `srs' field.
	* kernel/table21/module.c (TBL_PROC_SEGMENT): Added kernel support
	for this.

	* sysdeps/{linux, kernel, stub}/procmap.c: New files.
This commit is contained in:
Martin Baulig
1998-08-12 20:16:24 +00:00
committed by Martin Baulig
parent da622f70c7
commit 9248d72018
27 changed files with 369 additions and 124 deletions

View File

@@ -28,12 +28,33 @@ static const unsigned long _glibtop_sysdeps_proc_mem =
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
#ifndef LOG1024
#define LOG1024 10
#endif
/* these are for getting the memory statistics */
static int pageshift; /* log base 2 of the pagesize */
/* define pagetok in terms of pageshift */
#define pagetok(size) ((size) << pageshift)
/* Init function. */
void
glibtop_init_proc_mem_s (glibtop *server)
{
register int pagesize;
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
/* get the page size with "getpagesize" and calculate pageshift
* from it */
pagesize = getpagesize ();
pageshift = 0;
while (pagesize > 1) {
pageshift++;
pagesize >>= 1;
}
}
/* Provides detailed information about a process. */
@@ -93,6 +114,11 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
sscanf (input, "%Lu %Lu %Lu",
&buf->size, &buf->resident, &buf->share);
buf->size <<= pageshift;
buf->resident <<= pageshift;
buf->share <<= pageshift;
buf->rss <<= pageshift;
fclose (f);
buf->flags = _glibtop_sysdeps_proc_mem;