add queue metric, fixup formatting

This commit is contained in:
Doug MacEachern 2005-04-07 02:06:24 +00:00
parent 009d51854c
commit 14960e14e5
1 changed files with 20 additions and 5 deletions

View File

@ -17,15 +17,16 @@ import net.hyperic.sigar.util.GetlineCompleter;
public class Iostat extends SigarCommandBase { public class Iostat extends SigarCommandBase {
private static final String OUTPUT_FORMAT = private static final String OUTPUT_FORMAT =
"%-15s %-15s %-10s %-10s %-10s %-10s"; "%-15s %-15s %10s %10s %7s %7s %5s";
private static final String[] HEADER = new String[] { private static final String[] HEADER = new String[] {
"Filesystem", "Filesystem",
"Mounted on", "Mounted on",
"Reads", "Reads",
"Writes", "Writes",
"Bytes Read", "R-bytes",
"Bytes Written", "W-bytes",
"Queue",
}; };
private GetlineCompleter completer; private GetlineCompleter completer;
@ -97,8 +98,22 @@ public class Iostat extends SigarCommandBase {
items.add(fs.getDirName()); items.add(fs.getDirName());
items.add(String.valueOf(usage.getDiskReads())); items.add(String.valueOf(usage.getDiskReads()));
items.add(String.valueOf(usage.getDiskWrites())); items.add(String.valueOf(usage.getDiskWrites()));
items.add(Sigar.formatSize(usage.getDiskReadBytes()));
items.add(Sigar.formatSize(usage.getDiskWriteBytes())); if (usage.getDiskReadBytes() == Sigar.FIELD_NOTIMPL) {
items.add("-");
items.add("-");
}
else {
items.add(Sigar.formatSize(usage.getDiskReadBytes()));
items.add(Sigar.formatSize(usage.getDiskWriteBytes()));
}
if (usage.getDiskQueue() == Sigar.FIELD_NOTIMPL) {
items.add("-");
}
else {
items.add(String.valueOf(usage.getDiskQueue()));
}
printf(items); printf(items);
} }