public class CpuInfo extends Object
CPU相关信息
Constructor and Description |
---|
CpuInfo()
空构造
|
CpuInfo(oshi.hardware.CentralProcessor processor,
long waitingTime)
构造,等待时间为用于计算在一定时长内的CPU负载情况,如传入1000表示最近1秒的负载情况
|
CpuInfo(Integer cpuNum,
double toTal,
double sys,
double user,
double wait,
double free,
String cpuModel)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
getCpuModel() |
Integer |
getCpuNum() |
double |
getFree() |
double |
getSys() |
CpuTicks |
getTicks() |
double |
getToTal() |
double |
getUsed()
获取用户+系统的总的CPU使用率
|
double |
getUser() |
double |
getWait() |
void |
setCpuModel(String cpuModel) |
void |
setCpuNum(Integer cpuNum) |
void |
setFree(double free) |
void |
setSys(double sys) |
void |
setTicks(CpuTicks ticks) |
void |
setToTal(double toTal) |
void |
setUser(double user) |
void |
setWait(double wait) |
String |
toString() |
public CpuInfo()
public CpuInfo(oshi.hardware.CentralProcessor processor, long waitingTime)
processor
- CentralProcessor
waitingTime
- 设置等待时间,单位毫秒public Integer getCpuNum()
public void setCpuNum(Integer cpuNum)
public double getToTal()
public void setToTal(double toTal)
public double getSys()
public void setSys(double sys)
public double getUser()
public void setUser(double user)
public double getWait()
public void setWait(double wait)
public double getFree()
public void setFree(double free)
public String getCpuModel()
public void setCpuModel(String cpuModel)
public CpuTicks getTicks()
public void setTicks(CpuTicks ticks)
public double getUsed()
Copyright © 2024. All rights reserved.