format time
This commit is contained in:
parent
8021f4de5b
commit
183359750f
|
@ -33,17 +33,21 @@ public class Time extends SigarCommandBase {
|
||||||
this.shell.handleCommand("time " + args[0], args);
|
this.shell.handleCommand("time " + args[0], args);
|
||||||
|
|
||||||
cpu.gather(this.sigar, 0);
|
cpu.gather(this.sigar, 0);
|
||||||
System.out.println("real....." +
|
println("real....." +
|
||||||
(System.currentTimeMillis() - start) / 1000);
|
format((System.currentTimeMillis() - start)));
|
||||||
System.out.println("user....." + toMillis(cpu.getUser()));
|
println("user....." + format(toMillis(cpu.getUser())));
|
||||||
System.out.println("sys......" + toMillis(cpu.getSys()));
|
println("sys......" + format(toMillis(cpu.getSys())));
|
||||||
System.out.println("total...." + toMillis(cpu.getTotal()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long toMillis(long nano) {
|
private static long toMillis(long nano) {
|
||||||
return nano / 1000000;
|
return nano / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String format(long t) {
|
||||||
|
t /= 1000;
|
||||||
|
return t/60 + ":" + t%60;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
new Time().processCommand(args);
|
new Time().processCommand(args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue