summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoît Dejean <bdejean@src.gnome.org>2008-06-22 10:50:29 +0000
committerBenoît Dejean <bdejean@src.gnome.org>2008-06-22 10:50:29 +0000
commit229eab1213b56fdfddda8a2e83114fbdc5e5d1ba (patch)
tree5acf03dfb397bc025fa58a220189aaee2ed55e84
parent791e0dd85964dbfcce139e9ebfd5045b773c39d9 (diff)
downloadlibgtop-229eab1213b56fdfddda8a2e83114fbdc5e5d1ba.tar.gz
Updated example to display read/write counters.
svn path=/trunk/; revision=2756
-rw-r--r--examples/df.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/df.c b/examples/df.c
index 60e94e82..27be1371 100644
--- a/examples/df.c
+++ b/examples/df.c
@@ -15,12 +15,14 @@ static void print_fsusage(const char *mountpoint)
glibtop_get_fsusage(&buf, mountpoint);
- printf("%-20s %-10llu %-10llu %-10llu %.1f\n",
+ printf("%-30s %10llu %10llu %10llu %5.1f %10llu %10llu\n",
mountpoint,
buf.blocks * buf.block_size >> 20,
(buf.blocks - buf.bavail) * buf.block_size >> 20,
buf.bavail * buf.block_size >> 20,
- (buf.blocks - buf.bavail) * 100.0 / buf.blocks
+ (buf.blocks - buf.bavail) * 100.0 / (buf.blocks ? buf.blocks : 1.0),
+ buf.read,
+ buf.write
);
}
@@ -33,8 +35,8 @@ int main()
glibtop_init();
- printf("%-20s %-10s %-10s %-10s %-10s\n",
- "Filesystem", "Size", "Used", "Avail", "Use%");
+ printf("%-30s %10s %10s %10s %5s %10s %10s\n",
+ "Filesystem", "Size", "Used", "Avail", "Use%", "Read", "Write");
entries = glibtop_get_mountlist(&buf, TRUE);