remove setters, just use the fields
This commit is contained in:
parent
df88ea5bb4
commit
5a31d9cdab
|
@ -10,7 +10,7 @@ public class CpuPerc {
|
||||||
private double idle;
|
private double idle;
|
||||||
private double wait;
|
private double wait;
|
||||||
|
|
||||||
CpuPerc(){ }
|
CpuPerc() {}
|
||||||
|
|
||||||
static CpuPerc calculate(Cpu oldCpu, Cpu curCpu) {
|
static CpuPerc calculate(Cpu oldCpu, Cpu curCpu) {
|
||||||
double diffUser, diffSys, diffNice, diffIdle, diffWait, diffTotal;
|
double diffUser, diffSys, diffNice, diffIdle, diffWait, diffTotal;
|
||||||
|
@ -32,54 +32,34 @@ public class CpuPerc {
|
||||||
diffTotal = diffUser + diffSys + diffNice + diffIdle + diffWait;
|
diffTotal = diffUser + diffSys + diffNice + diffIdle + diffWait;
|
||||||
|
|
||||||
CpuPerc perc = new CpuPerc();
|
CpuPerc perc = new CpuPerc();
|
||||||
perc.setUser(diffUser / diffTotal);
|
perc.user = diffUser / diffTotal;
|
||||||
perc.setSys(diffSys / diffTotal);
|
perc.sys = diffSys / diffTotal;
|
||||||
perc.setNice(diffNice / diffTotal);
|
perc.nice = diffNice / diffTotal;
|
||||||
perc.setIdle(diffIdle / diffTotal);
|
perc.idle = diffIdle / diffTotal;
|
||||||
perc.setWait(diffWait / diffTotal);
|
perc.wait = diffWait / diffTotal;
|
||||||
return perc;
|
return perc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getUser(){
|
public double getUser() {
|
||||||
return this.user;
|
return this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUser(double user){
|
public double getSys() {
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getSys(){
|
|
||||||
return this.sys;
|
return this.sys;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSys(double sys){
|
public double getNice() {
|
||||||
this.sys = sys;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getNice(){
|
|
||||||
return this.nice;
|
return this.nice;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNice(double nice){
|
public double getIdle() {
|
||||||
this.nice = nice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getIdle(){
|
|
||||||
return this.idle;
|
return this.idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIdle(double idle){
|
public double getWait() {
|
||||||
this.idle = idle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getWait(){
|
|
||||||
return this.wait;
|
return this.wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWait(double wait){
|
|
||||||
this.wait = wait;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getCombined() {
|
public double getCombined() {
|
||||||
return this.user + this.sys;
|
return this.user + this.sys;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +80,7 @@ public class CpuPerc {
|
||||||
format(this.user) + " user, " +
|
format(this.user) + " user, " +
|
||||||
format(this.sys) + " system, " +
|
format(this.sys) + " system, " +
|
||||||
format(this.nice) + " nice, " +
|
format(this.nice) + " nice, " +
|
||||||
|
format(this.wait) + " wait, " +
|
||||||
format(this.idle) + " idle";
|
format(this.idle) + " idle";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue