From 14960e14e5a3aad1f3e5d83eb6f704cbd2ff5797 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 7 Apr 2005 02:06:24 +0000 Subject: [PATCH] add queue metric, fixup formatting --- .../src/net/hyperic/sigar/cmd/Iostat.java | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Iostat.java b/bindings/java/src/net/hyperic/sigar/cmd/Iostat.java index 1d15bd0e..72f45fd5 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Iostat.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Iostat.java @@ -17,15 +17,16 @@ import net.hyperic.sigar.util.GetlineCompleter; public class Iostat extends SigarCommandBase { 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[] { "Filesystem", "Mounted on", "Reads", "Writes", - "Bytes Read", - "Bytes Written", + "R-bytes", + "W-bytes", + "Queue", }; private GetlineCompleter completer; @@ -97,8 +98,22 @@ public class Iostat extends SigarCommandBase { items.add(fs.getDirName()); items.add(String.valueOf(usage.getDiskReads())); 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); }