Add load averages to OS stats on FreeBSD
This commit adds load averages to the OS stats on FreeBSD. For these stats to be available, linprocfs must be available and mounted at /compat/linux/proc.
This commit is contained in:
parent
78dc1c32de
commit
2839e351af
|
@ -111,8 +111,9 @@ public class OsProbe {
|
|||
* Returns the system load averages
|
||||
*/
|
||||
public double[] getSystemLoadAverage() {
|
||||
if (Constants.LINUX) {
|
||||
double[] loadAverage = readProcLoadavg("/proc/loadavg");
|
||||
if (Constants.LINUX || Constants.FREE_BSD) {
|
||||
final String procLoadAvg = Constants.LINUX ? "/proc/loadavg" : "/compat/linux/proc/loadavg";
|
||||
double[] loadAverage = readProcLoadavg(procLoadAvg);
|
||||
if (loadAverage != null) {
|
||||
return loadAverage;
|
||||
}
|
||||
|
|
|
@ -118,4 +118,7 @@ grant {
|
|||
|
||||
// load averages on Linux
|
||||
permission java.io.FilePermission "/proc/loadavg", "read";
|
||||
|
||||
// load averages on FreeBSD
|
||||
permission java.io.FilePermission "/compat/linux/proc/loadavg", "read";
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue