本文整理汇总了Java中org.hyperic.sigar.Mem.getActualFree方法的典型用法代码示例。如果您正苦于以下问题:Java Mem.getActualFree方法的具体用法?Java Mem.getActualFree怎么用?Java Mem.getActualFree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hyperic.sigar.Mem
的用法示例。
在下文中一共展示了Mem.getActualFree方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCurrentWorkerStat
import org.hyperic.sigar.Mem; //导入方法依赖的package包/类
public WorkerStat getCurrentWorkerStat(){
try {
CpuPerc cpp=sigar.getCpuPerc();
Mem mem=sigar.getMem();
workerStat.cpuUsage=cpp.getCombined();
workerStat.memUsed=mem.getActualUsed();
workerStat.memFree=mem.getActualFree();
workerStat.timestampMS=System.currentTimeMillis();
workerStat.instanceCount=worker.insMap.size();
return workerStat;
}
catch (SigarException e) {
e.printStackTrace();
return workerStat;
}
}
示例2: output
import org.hyperic.sigar.Mem; //导入方法依赖的package包/类
public void output(String[] args) throws SigarException {
Mem mem = this.sigar.getMem();
Swap swap = this.sigar.getSwap();
Object[] header = new Object[] { "total", "used", "free" };
Object[] memRow = new Object[] {
format(mem.getTotal()),
format(mem.getUsed()),
format(mem.getFree())
};
Object[] actualRow = new Object[] {
format(mem.getActualUsed()),
format(mem.getActualFree())
};
Object[] swapRow = new Object[] {
format(swap.getTotal()),
format(swap.getUsed()),
format(swap.getFree())
};
printf("%18s %10s %10s", header);
printf("Mem: %10ld %10ld %10ld", memRow);
//e.g. linux
if ((mem.getUsed() != mem.getActualUsed()) ||
(mem.getFree() != mem.getActualFree()))
{
printf("-/+ buffers/cache: " + "%10ld %10d", actualRow);
}
printf("Swap: %10ld %10ld %10ld", swapRow);
printf("RAM: %10ls", new Object[] { mem.getRam() + "MB" });
}
示例3: getValue
import org.hyperic.sigar.Mem; //导入方法依赖的package包/类
@Override
public void getValue(StringBuffer res) throws SigarException {
Mem mem = this.sigarProxy.getMem();
int factor = 1;
double val;
switch (this.type) {
case 0:
val = mem.getActualFree();
factor = this.dividingFactor;
break;
case 1:
val = mem.getActualUsed();
factor = this.dividingFactor;
break;
case 2:
val = mem.getFree();
factor = this.dividingFactor;
break;
case 3:
val = mem.getFreePercent();
break;
case 4:
val = mem.getRam();
break;
case 5:
val = mem.getTotal();
factor = this.dividingFactor;
break;
case 6:
val = mem.getUsed();
factor = this.dividingFactor;
break;
case 7:
val = mem.getUsedPercent();
break;
default:
throw new SigarException("Unknown total mem type " + this.type);
}
val /= factor;
res.append(Double.toString(val));
}
示例4: getMemInfo
import org.hyperic.sigar.Mem; //导入方法依赖的package包/类
public static MemInfo getMemInfo() {
LOGGER.debug("Getting memory info...");
try {
Mem mem = sigar.getMem();
Swap swap = sigar.getSwap();
MemInfo memInfo = new MemInfo(mem.getTotal(), mem.getActualUsed(), mem.getActualFree(), swap.getTotal() - mem.getTotal(), swap.getUsed()
- mem.getActualUsed(), swap.getFree());
LOGGER.debug("Memory info: {}", memInfo);
return memInfo;
} catch (SigarException e) {
throw new AgentException("Error reading memory info", e);
}
}