From ddaf40345b975937794fbb6a8227191506d0f44b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 4 Nov 2007 03:24:44 +0000 Subject: [PATCH] add Svctm --- .../src/org/hyperic/sigar/cmd/Iostat.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Iostat.java b/bindings/java/src/org/hyperic/sigar/cmd/Iostat.java index dfee8b82..5780854a 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Iostat.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Iostat.java @@ -36,7 +36,7 @@ import org.hyperic.sigar.util.GetlineCompleter; public class Iostat extends SigarCommandBase { private static final String OUTPUT_FORMAT = - "%-15s %-15s %10s %10s %7s %7s %5s"; + "%-15s %-15s %10s %10s %7s %7s %5s %5s"; private static final String[] HEADER = new String[] { "Filesystem", @@ -46,6 +46,7 @@ public class Iostat extends SigarCommandBase { "R-bytes", "W-bytes", "Queue", + "Svctm", }; private GetlineCompleter completer; @@ -81,6 +82,10 @@ public class Iostat extends SigarCommandBase { printf(HEADER); } + private String svctm(double val) { + return sprintf("%3.2f", new Object[] { new Double(val) }); + } + public void output(String[] args) throws SigarException { if (args.length == 1) { String arg = args[0]; @@ -144,6 +149,13 @@ public class Iostat extends SigarCommandBase { items.add(String.valueOf(disk.getQueue())); } + if (disk.getServiceTime() == Sigar.FIELD_NOTIMPL) { + items.add("-"); + } + else { + items.add(svctm(disk.getServiceTime())); + } + printf(items); } @@ -173,6 +185,12 @@ public class Iostat extends SigarCommandBase { else { items.add(String.valueOf(usage.getDiskQueue())); } + if (usage.getDiskServiceTime() == Sigar.FIELD_NOTIMPL) { + items.add("-"); + } + else { + items.add(svctm(usage.getDiskServiceTime())); + } printf(items); }