From ab3abd5119a37837d1620fbdc5f00f0e211e00a8 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 14 Dec 2005 01:28:44 +0000 Subject: [PATCH] add dir_stat.disk_usage --- bindings/java/src/jni/generate.pl | 3 +++ bindings/java/src/net/hyperic/sigar/cmd/Watch.java | 1 + include/sigar_fileinfo.h | 1 + src/sigar_fileinfo.c | 2 ++ 4 files changed, 7 insertions(+) diff --git a/bindings/java/src/jni/generate.pl b/bindings/java/src/jni/generate.pl index dbb531c1..6aaa2be0 100644 --- a/bindings/java/src/jni/generate.pl +++ b/bindings/java/src/jni/generate.pl @@ -586,6 +586,9 @@ my %classes = ( { name => 'sockets', type => 'Long', }, + { + name => 'disk_usage', type => 'Long', + }, ], NetInfo => [ { diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Watch.java b/bindings/java/src/net/hyperic/sigar/cmd/Watch.java index 3592d964..944e9269 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Watch.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Watch.java @@ -51,6 +51,7 @@ public class Watch { System.out.println(" Blkdevs....." + stats.getBlkdevs()); System.out.println(" Sockets....." + stats.getSockets()); System.out.println(" Total......." + stats.getTotal()); + System.out.println(" Disk Usage.." + stats.getDiskUsage()); } } diff --git a/include/sigar_fileinfo.h b/include/sigar_fileinfo.h index 0e379f5b..4356b8ce 100644 --- a/include/sigar_fileinfo.h +++ b/include/sigar_fileinfo.h @@ -110,6 +110,7 @@ typedef struct { sigar_uint64_t chrdevs; sigar_uint64_t blkdevs; sigar_uint64_t sockets; + sigar_uint64_t disk_usage; } sigar_dir_stat_t; SIGAR_DECLARE(const char *) diff --git a/src/sigar_fileinfo.c b/src/sigar_fileinfo.c index ecfca9c2..c3a43582 100644 --- a/src/sigar_fileinfo.c +++ b/src/sigar_fileinfo.c @@ -634,6 +634,8 @@ int sigar_dir_stat_get(sigar_t *sigar, continue; } + dirstats->disk_usage += info.st_size; + switch (filetype_from_mode(info.st_mode)) { case SIGAR_FILETYPE_REG: ++dirstats->files;