Merge pull request #15934 from jasontedor/freebsd-load-average

Add load averages to OS stats on FreeBSD

Closes #15917
This commit is contained in:
Jason Tedor 2016-01-13 20:11:22 -05:00
commit d5e20fb763
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";
};