add file_system_usage_t.used field
This commit is contained in:
parent
4beb4e6fc4
commit
22452e99fc
@ -356,6 +356,7 @@ namespace Hyperic.Sigar {
|
|||||||
public readonly ulong Total;
|
public readonly ulong Total;
|
||||||
public readonly ulong Free;
|
public readonly ulong Free;
|
||||||
public readonly ulong Avail;
|
public readonly ulong Avail;
|
||||||
|
public readonly ulong Used;
|
||||||
private readonly ulong NA_Files; //XXX not implemented
|
private readonly ulong NA_Files; //XXX not implemented
|
||||||
private readonly ulong NA_FreeFiles;
|
private readonly ulong NA_FreeFiles;
|
||||||
private readonly ulong DiskReads;
|
private readonly ulong DiskReads;
|
||||||
|
@ -453,6 +453,11 @@ my %classes = (
|
|||||||
desc => 'Total free bytes on filesytem',
|
desc => 'Total free bytes on filesytem',
|
||||||
plat => '*'
|
plat => '*'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name => 'used', type => 'Long',
|
||||||
|
desc => 'Total used bytes on filesystem',
|
||||||
|
plat => '*'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name => 'avail', type => 'Long',
|
name => 'avail', type => 'Long',
|
||||||
desc => 'Total free bytes on filesytem available to caller',
|
desc => 'Total free bytes on filesytem available to caller',
|
||||||
|
@ -49,8 +49,9 @@ public class TestFileSystem extends SigarTestCase {
|
|||||||
//possible machines have full filesystems
|
//possible machines have full filesystems
|
||||||
assertGtEqZeroTrace(" Free", usage.getFree());
|
assertGtEqZeroTrace(" Free", usage.getFree());
|
||||||
assertGtEqZeroTrace(" Avail", usage.getAvail());
|
assertGtEqZeroTrace(" Avail", usage.getAvail());
|
||||||
|
assertGtEqZeroTrace(" Used", usage.getUsed());
|
||||||
double usePercent = usage.getUsePercent() * 100;
|
double usePercent = usage.getUsePercent() * 100;
|
||||||
traceln(" Used=" + usePercent + "%");
|
traceln(" Usage=" + usePercent + "%");
|
||||||
assertTrue(usePercent <= 100.0);
|
assertTrue(usePercent <= 100.0);
|
||||||
default:
|
default:
|
||||||
traceln(" DiskReads=" + usage.getDiskReads());
|
traceln(" DiskReads=" + usage.getDiskReads());
|
||||||
|
@ -340,6 +340,7 @@ typedef struct {
|
|||||||
sigar_uint64_t
|
sigar_uint64_t
|
||||||
total,
|
total,
|
||||||
free,
|
free,
|
||||||
|
used,
|
||||||
avail,
|
avail,
|
||||||
files,
|
files,
|
||||||
free_files,
|
free_files,
|
||||||
|
@ -1750,6 +1750,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_ffree;
|
fsusage->free_files = buf.f_ffree;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -1074,6 +1074,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_files;
|
fsusage->free_files = buf.f_files;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -594,6 +594,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_ffree;
|
fsusage->free_files = buf.f_ffree;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -1147,6 +1147,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_ffree;
|
fsusage->free_files = buf.f_ffree;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -458,6 +458,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_ffree;
|
fsusage->free_files = buf.f_ffree;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -1384,6 +1384,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_blocks);
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bfree);
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(buf, f_bavail);
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->files = buf.f_files;
|
fsusage->files = buf.f_files;
|
||||||
fsusage->free_files = buf.f_files;
|
fsusage->free_files = buf.f_files;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
@ -200,6 +200,7 @@ int sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = -1;
|
fsusage->total = -1;
|
||||||
fsusage->free = -1;
|
fsusage->free = -1;
|
||||||
fsusage->avail = -1;
|
fsusage->avail = -1;
|
||||||
|
fsusage->used = -1;
|
||||||
fsusage->files = -1;
|
fsusage->files = -1;
|
||||||
fsusage->free_files = -1;
|
fsusage->free_files = -1;
|
||||||
SIGAR_DISK_STATS_NOTIMPL(fsusage);
|
SIGAR_DISK_STATS_NOTIMPL(fsusage);
|
||||||
|
@ -1566,7 +1566,7 @@ sigar_file_system_usage_get(sigar_t *sigar,
|
|||||||
fsusage->total = total.QuadPart / 1024;
|
fsusage->total = total.QuadPart / 1024;
|
||||||
fsusage->free = free.QuadPart / 1024;
|
fsusage->free = free.QuadPart / 1024;
|
||||||
fsusage->avail = avail.QuadPart / 1024;
|
fsusage->avail = avail.QuadPart / 1024;
|
||||||
|
fsusage->used = fsusage->total - fsusage->free;
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
|
||||||
/* N/A */
|
/* N/A */
|
||||||
|
Loading…
Reference in New Issue
Block a user