summaryrefslogtreecommitdiff
path: root/libjava/gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc
blob: daea76bbf7a3106f75a830227fa02aa630a9541d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <config.h>

#include <gnu/java/lang/management/VMOperatingSystemMXBeanImpl.h>
#include <gcj/cni.h>
#include <java/lang/UnsupportedOperationException.h>

jdouble
gnu::java::lang::management::VMOperatingSystemMXBeanImpl::getSystemLoadAverage ()
{
#ifdef HAVE_GETLOADAVG
  double avg[1];
  int nos = getloadavg(avg, 1);
  if (nos == 1)
    return avg[0];
  else
#endif
    return -1;
}