need to diff the cpu times

This commit is contained in:
Doug MacEachern 2005-02-25 01:16:55 +00:00
parent 183359750f
commit d3306f6b1b
1 changed files with 5 additions and 2 deletions

View File

@ -28,6 +28,9 @@ public class Time extends SigarCommandBase {
public void output(String[] args) throws SigarException {
ThreadCpu cpu = new ThreadCpu();
cpu.gather(this.sigar, 0);
long user = cpu.getUser();
long sys = cpu.getSys();
long start = System.currentTimeMillis();
this.shell.handleCommand("time " + args[0], args);
@ -35,8 +38,8 @@ public class Time extends SigarCommandBase {
cpu.gather(this.sigar, 0);
println("real....." +
format((System.currentTimeMillis() - start)));
println("user....." + format(toMillis(cpu.getUser())));
println("sys......" + format(toMillis(cpu.getSys())));
println("user....." + format(toMillis(cpu.getUser() - user)));
println("sys......" + format(toMillis(cpu.getSys() - sys)));
}
private static long toMillis(long nano) {