File: diskio.c

package info (click to toggle)
libgtop2 2.38.0-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,944 kB
  • sloc: ansic: 25,286; sh: 7,044; makefile: 416; perl: 268; xml: 179; sed: 16
file content (39 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (2)
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 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);

}


int main(int argc, char **argv)
{
  glibtop_init();

  while(*++argv)
    {
      pid_t pid = strtol(*argv, NULL, 10);
      show_diskio(pid);
    }

  glibtop_close();

  return 0;
}