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:
committed by
Martin Baulig
parent
fc506344ea
commit
2e454140f1
@@ -27,7 +27,8 @@
|
||||
|
||||
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);
|
||||
|
||||
/* Provides information about swap usage. */
|
||||
|
||||
@@ -48,4 +49,7 @@ glibtop_get_swap_s (glibtop *server, glibtop_swap *buf)
|
||||
buf->total = tbl.swap.total;
|
||||
buf->used = tbl.swap.used;
|
||||
buf->free = tbl.swap.free;
|
||||
|
||||
buf->pagein = tbl.swap.pagein;
|
||||
buf->pageout = tbl.swap.pageout;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -23,24 +23,29 @@
|
||||
|
||||
const char *glibtop_names_swap [GLIBTOP_MAX_SWAP] =
|
||||
{
|
||||
"total", "used", "free"
|
||||
"total", "used", "free", "pagein", "pageout"
|
||||
};
|
||||
|
||||
const unsigned glibtop_types_swap [GLIBTOP_MAX_SWAP] =
|
||||
{
|
||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
|
||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
|
||||
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
|
||||
};
|
||||
|
||||
const char *glibtop_labels_swap [GLIBTOP_MAX_SWAP] =
|
||||
{
|
||||
N_("Total Swap Space"),
|
||||
N_("Used Swap Space"),
|
||||
N_("Free Swap Space")
|
||||
N_("Free Swap Space"),
|
||||
N_("Page In"),
|
||||
N_("Page Out"),
|
||||
};
|
||||
|
||||
const char *glibtop_descriptions_swap [GLIBTOP_MAX_SWAP] =
|
||||
{
|
||||
N_("Total Swap Space"),
|
||||
N_("Used Swap Space"),
|
||||
N_("Free Swap Space")
|
||||
N_("Free Swap Space"),
|
||||
N_("Total number of swap pages that have been brought in"),
|
||||
N_("Total number of swap pages that have been brought out"),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user