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;