Added pagein' and pageout'.

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

	* include/glibtop/swap.h (glibtop_swap): Added `pagein' and `pageout'.

	* kernel/table20/table.h: Removed.
	* kernel/table21/table.h: Removed.
	* kernel/table.h: Added. Things are now binary compatible between
	both kernel versions.
This commit is contained in:
Martin Baulig
1998-08-01 22:03:11 +00:00
committed by Martin Baulig
parent fc506344ea
commit 2e454140f1
11 changed files with 59 additions and 181 deletions

View File

@@ -23,9 +23,12 @@
#include <glibtop/error.h>
#include <glibtop/swap.h>
#include <fcntl.h>
static unsigned long _glibtop_sysdeps_swap =
(1 << GLIBTOP_SWAP_TOTAL) + (1 << GLIBTOP_SWAP_USED) +
(1 << GLIBTOP_SWAP_FREE);
(1 << GLIBTOP_SWAP_FREE) + (1 << GLIBTOP_SWAP_PAGEIN) +
(1 << GLIBTOP_SWAP_PAGEOUT);
#define FILENAME "/proc/meminfo"
@@ -34,6 +37,8 @@ static unsigned long _glibtop_sysdeps_swap =
void
glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
{
char buffer [BUFSIZ+1], *ptr;
int fd, len;
FILE *f;
glibtop_init_s (&server, 0, 0);
@@ -49,4 +54,14 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
&buf->total, &buf->used, &buf->free);
fclose (f);
fd = open ("/proc/stat", O_RDONLY);
len = read (fd, buffer, BUFSIZ);
close (fd);
ptr = strstr (buffer, "\nswap");
if (ptr == NULL) return;
sscanf (ptr, "\nSwap: %Lu %Lu\n",
&buf->pagein, &buf->pageout);
}