From 2246f7e7478c0229c41d545d1823e4998d4f3f6c Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 21 Jul 2005 02:15:46 +0000 Subject: [PATCH] allow int arg to specific number of iterations --- .../java/src/net/hyperic/sigar/cmd/Time.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Time.java b/bindings/java/src/net/hyperic/sigar/cmd/Time.java index c2efe153..061a11a6 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Time.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Time.java @@ -30,10 +30,25 @@ public class Time extends SigarCommandBase { //turn off paging. this.shell.setInteractive(false); CpuTimer cpu = new CpuTimer(this.sigar); + + int num; + + if (Character.isDigit(args[0].charAt(0))) { + num = Integer.parseInt(args[0]); + String[] xargs = new String[args.length-1]; + System.arraycopy(args, 1, xargs, 0, xargs.length); + args = xargs; + } + else { + num = 1; + } + cpu.start(); try { - this.shell.handleCommand("time " + args[0], args); + for (int i=0; i