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:
Jason Tedor 2016-01-12 12:08:25 -05:00
parent 78dc1c32de
commit 2839e351af
2 changed files with 6 additions and 2 deletions

View File

@ -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;
}

View File

@ -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";
};