remove Total method, super class has it now

This commit is contained in:
Doug MacEachern 2004-08-21 00:25:37 +00:00
parent 4736d77c87
commit 9b89e1b9f8
1 changed files with 2 additions and 11 deletions

View File

@ -13,13 +13,11 @@ public class ProcCpu extends ProcTime {
private long lastTime = 0; private long lastTime = 0;
private long pid; private long pid;
private long time = 0;
private double percent = 0.0; private double percent = 0.0;
private void getValues(Sigar sigar, long pid) private void getValues(Sigar sigar, long pid)
throws SigarException { throws SigarException {
this.nativeGet(sigar, pid); this.nativeGet(sigar, pid);
this.time = this.user + this.sys;
} }
static synchronized ProcCpu get(Sigar sigar, long pid) static synchronized ProcCpu get(Sigar sigar, long pid)
@ -44,7 +42,7 @@ public class ProcCpu extends ProcTime {
cpu.lastTime = timeNow; cpu.lastTime = timeNow;
long otime = cpu.time; long otime = cpu.total;
cpu.getValues(sigar, pid); cpu.getValues(sigar, pid);
@ -53,7 +51,7 @@ public class ProcCpu extends ProcTime {
return cpu; return cpu;
} }
cpu.percent = ((cpu.time - otime) / diff); cpu.percent = ((cpu.total - otime) / diff);
if (cpu.percent >= 1.0) { if (cpu.percent >= 1.0) {
cpu.percent = 0.99; cpu.percent = 0.99;
} }
@ -68,13 +66,6 @@ public class ProcCpu extends ProcTime {
return this.percent; return this.percent;
} }
/**
* @return Sum of User and Sys.
*/
public long getTotal() {
return this.time;
}
/** /**
* @return Pid of the process. * @return Pid of the process.
*/ */