FileSystemUsage usage;
try {
usage = sigar.getFileSystemUsage(fs.getDirName());
} catch (SigarException e) {
if (fs.getType() == FileSystem.TYPE_LOCAL_DISK) {
throw e;
}
//else ok, e.g. floppy drive on windows
continue;
}
switch (fs.getType()) {
case FileSystem.TYPE_LOCAL_DISK:
assertGtZeroTrace(" Total", usage.getTotal());
//possible machines have full filesystems
assertGtEqZeroTrace(" Free", usage.getFree());
assertGtEqZeroTrace(" Avail", usage.getAvail());
assertGtEqZeroTrace(" Used", usage.getUsed());
double usePercent = usage.getUsePercent() * 100;
traceln(" Usage=" + usePercent + "%");
assertTrue(usePercent <= 100.0);
default:
traceln(" DiskReads=" + usage.getDiskReads());
traceln(" DiskWrites=" + usage.getDiskWrites());
}
try {
usage = sigar.getFileSystemUsage(fs.getDirName());
} catch (SigarException e) {
if (fs.getType() == FileSystem.TYPE_LOCAL_DISK) {
throw e;
}
//else ok, e.g. floppy drive on windows
continue;
}
switch (fs.getType()) {
case FileSystem.TYPE_LOCAL_DISK:
assertGtZeroTrace(" Total", usage.getTotal());
//possible machines have full filesystems
assertGtEqZeroTrace(" Free", usage.getFree());
assertGtEqZeroTrace(" Avail", usage.getAvail());
assertGtEqZeroTrace(" Used", usage.getUsed());
double usePercent = usage.getUsePercent() * 100;
traceln(" Usage=" + usePercent + "%");
assertTrue(usePercent <= 100.0);
default:
traceln(" DiskReads=" + usage.getDiskReads());
traceln(" DiskWrites=" + usage.getDiskWrites());
}
댓글
댓글 쓰기