Java方法返回Unix中的操作系统内存使用情况

huangapple 未分类评论49阅读模式
英文:

Java method to return the OS ram usage in unix

问题

我想创建一个方法来返回主操作系统的内存使用情况,而不是我尝试使用RunTime类并且它只返回JVM内存使用情况,但我想要的是操作系统级别的。

英文:

I want to create a method to return the ram usage in the main OS NOT THE OS I tried the RunTime class and it return only the JVM ram usage, but I want it for the OS level

答案1

得分: 0

如果您不需要可移植性,您可以阅读 /proc/meminfo,这可能是您正在寻找的内容,并且应该很容易解析。

但需要注意的是,旧的内核版本可能具有较少的信息行。有关详细信息,请参阅 https://access.redhat.com/solutions/406773

英文:

If you don't need portability you could read /proc/meminfo it might be what you are looking for and should be straight forward to parse.

A word of warning though, older kernel versions may have fewer rows of information. See for details https://access.redhat.com/solutions/406773

huangapple
  • 本文由 发表于 2020年4月7日 02:48:02
  • 转载请务必保留本文链接:https://java.coder-hub.com/61066842.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定