blob: 112b47231e67b3f6355187d1d51c3809aa6af430 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <glibtop.h>
#include <glibtop/procio.h>
#include <stdlib.h>
#include <unistd.h>
static void show_diskio(pid_t pid)
{
glibtop_proc_io io;
glibtop_get_proc_io (&io, 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);
}
int main(int argc, char **argv)
{
glibtop_init();
while(*++argv)
{
pid_t pid = strtol(*argv, NULL, 10);
show_diskio(pid);
}
glibtop_close();
return 0;
}
|