Prepended disk io struct fields with disk_ prefix

This commit is contained in:
Robert Roth
2017-05-12 05:14:17 +03:00
parent 1bf16bfffd
commit 5880e04fcc
3 changed files with 19 additions and 19 deletions

View File

@@ -17,7 +17,7 @@ static void show_diskio(pid_t pid)
printf("<%ld>\t", (long)pid);
printf("flags: %08lx rchar : %lu, wchar : %lu, read_bytes : %lu, write_bytes : %lu\n", (unsigned long)io.flags, io.rchar, io.wchar, io.rbytes, io.wbytes);
printf("flags: %08lx disk_rchar : %lu, disk_wchar : %lu, disk_read_bytes : %lu, disk_write_bytes : %lu\n", (unsigned long)io.flags, io.disk_rchar, io.disk_wchar, io.disk_rbytes, io.disk_wbytes);
}

View File

@@ -27,10 +27,10 @@
G_BEGIN_DECLS
#define GLIBTOP_PROC_IO_RCHAR 0
#define GLIBTOP_PROC_IO_WCHAR 1
#define GLIBTOP_PROC_IO_RBYTES 2
#define GLIBTOP_PROC_IO_WBYTES 3
#define GLIBTOP_PROC_IO_DISK_RCHAR 0
#define GLIBTOP_PROC_IO_DISK_WCHAR 1
#define GLIBTOP_PROC_IO_DISK_RBYTES 2
#define GLIBTOP_PROC_IO_DISK_WBYTES 3
#define GLIBTOP_MAX_PROC_IO 3
@@ -40,15 +40,15 @@ typedef struct _glibtop_proc_io glibtop_proc_io;
/**
* glibtop_proc_io:
* @rchar: The number of bytes which this task has caused to be read from storage. This
* @disk_rchar: The number of bytes which this task has caused to be read from storage. This
* is simply the sum of bytes which this process passed to read() and pread(), also including tty IO,
* and it is unaffected by whether or not actual physical disk IO was required.
* @wchar: The number of bytes which this task has caused, or shall cause to be written
* @disk_wchar: The number of bytes which this task has caused, or shall cause to be written
* to disk. Similar caveats apply here as with rchar.
* @rbytes: Attempt to count the number of bytes which this process really did cause to
* @disk_rbytes: Attempt to count the number of bytes which this process really did cause to
* be fetched from the storage layer. Done at the submit_bio() level, so it is
* accurate for block-backed filesystems.
* @wbytes: Attempt to count the number of bytes which this process caused to be sent to
* @disk_wbytes: Attempt to count the number of bytes which this process caused to be sent to
* the storage layer. This is done at page-dirtying time.
*
* Process disk io data filled by glibtop_get_proc_io().
@@ -59,10 +59,10 @@ struct _glibtop_proc_io
/*< private >*/
guint64 flags;
/*< public >*/
guint64 rchar;
guint64 wchar;
guint64 rbytes;
guint64 wbytes;
guint64 disk_rchar;
guint64 disk_wchar;
guint64 disk_rbytes;
guint64 disk_wbytes;
};

View File

@@ -27,8 +27,8 @@
#include "glibtop_private.h"
static const unsigned long _glibtop_sysdeps_proc_io =
(1L << GLIBTOP_PROC_IO_RCHAR) + (1L << GLIBTOP_PROC_IO_WCHAR) +
(1L << GLIBTOP_PROC_IO_RBYTES) + (1L << GLIBTOP_PROC_IO_WBYTES);
(1L << GLIBTOP_PROC_IO_DISK_RCHAR) + (1L << GLIBTOP_PROC_IO_DISK_WCHAR) +
(1L << GLIBTOP_PROC_IO_DISK_RBYTES) + (1L << GLIBTOP_PROC_IO_DISK_WBYTES);
/* Init function. */
@@ -53,18 +53,18 @@ glibtop_get_proc_io_s (glibtop *server, glibtop_proc_io *buf, pid_t pid)
return;
p = skip_token (buffer);
buf->rchar = g_ascii_strtoull (p, &p, 10);
buf->disk_rchar = g_ascii_strtoull (p, &p, 10);
p = skip_line (p);
p = skip_token (p);
buf->wchar = g_ascii_strtoull (p, &p, 10);
buf->disk_wchar = g_ascii_strtoull (p, &p, 10);
p = skip_line (p);
p = skip_line (p);
p = skip_line (p);
p = skip_token (p);
buf->rbytes = g_ascii_strtoull (p, &p, 10);
buf->disk_rbytes = g_ascii_strtoull (p, &p, 10);
p = skip_line (p);
p = skip_token (p);
buf->wbytes = g_ascii_strtoull (p, &p, 10);
buf->disk_wbytes = g_ascii_strtoull (p, &p, 10);
buf->flags = _glibtop_sysdeps_proc_io;
}