[libgtop/wip/diskio] Add proc_diskio in sysdeps and timings tests.



commit afec9bbf58127a63008b0fd7bced797565079c14
Author: Benoît Dejean <bdejean gmail com>
Date:   Fri Feb 24 09:04:23 2017 +0100

    Add proc_diskio in sysdeps and timings tests.

 examples/sysdeps.c |    7 +++++--
 examples/timings.c |   20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/examples/sysdeps.c b/examples/sysdeps.c
index 5d55142..a63a354 100644
--- a/examples/sysdeps.c
+++ b/examples/sysdeps.c
@@ -92,9 +92,10 @@ main (int argc, char *argv [])
                "\tproc_time:\t%d\t0x%08lx\n"
                "\tproc_signal:\t%d\t0x%08lx\n"
                "\tproc_kernel:\t%d\t0x%08lx\n"
-               "\tproc_segment:\t%d\t0x%08lx\n\n"
+               "\tproc_segment:\t%d\t0x%08lx\n"
                "\tproc_args:\t%d\t0x%08lx\n"
-               "\tproc_map:\t%d\t0x%08lx\n\n"
+               "\tproc_map:\t%d\t0x%08lx\n"
+               "\tproc_diskio:\t%d\t0x%08lx\n\n"
                "\tmountlist:\t%d\t0x%08lx\n"
                "\tfsusage:\t%d\t0x%08lx\n\n"
                "\tnetload:\t%d\t0x%08lx\n"
@@ -137,6 +138,8 @@ main (int argc, char *argv [])
                (unsigned long) sysdeps.proc_args,
                FEATURE_CHECK(PROC_MAP),
                (unsigned long) sysdeps.proc_map,
+               FEATURE_CHECK(PROC_DISKIO),
+               (unsigned long) sysdeps.proc_diskio,
                FEATURE_CHECK(MOUNTLIST),
                (unsigned long) sysdeps.mountlist,
                FEATURE_CHECK(FSUSAGE),
diff --git a/examples/timings.c b/examples/timings.c
index 6c85da0..f7537a7 100644
--- a/examples/timings.c
+++ b/examples/timings.c
@@ -412,6 +412,26 @@ main (int argc, char *argv [])
                (long double) ELAPSED_UTIME / PROFILE_COUNT,
                (long double) ELAPSED_STIME / PROFILE_COUNT);
 
+
+       getrusage (RUSAGE_SELF, &rusage_start);
+
+       for (c = 0; c < PROFILE_COUNT; c++)
+               glibtop_get_proc_diskio (&data.proc_diskio, pid);
+
+       getrusage (RUSAGE_SELF, &rusage_end);
+
+       libgtop_timersub (&rusage_end.ru_utime, &rusage_start.ru_utime,
+                         &elapsed_utime);
+
+       libgtop_timersub (&rusage_end.ru_stime, &rusage_start.ru_stime,
+                         &elapsed_stime);
+
+       printf ("Proc_DiskIo  (0x%08lx): %7lu - %9.2Lf - %9.2Lf\n",
+               (unsigned long) data.proc_diskio.flags, PROFILE_COUNT,
+               (long double) ELAPSED_UTIME / PROFILE_COUNT,
+               (long double) ELAPSED_STIME / PROFILE_COUNT);
+
+
        getrusage (RUSAGE_SELF, &total_end);
 
        libgtop_timersub (&total_end.ru_utime, &total_start.ru_utime,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]