Returns the current load average.
171097
def load_average(self):
        
        with io.open(self.load_average_file, 'r') as f:
            file_columns = f.readline().strip().split()
            return float(file_columns[self._load_average_file_column])
1052786
def _parse_uptime_string(self, uptime):
        
        uptime = uptime.strip()
        load_averages = uptime[uptime.find('load average:') :].split(':')[1].strip().split(',')
        load_averages = [float(load_avg) for load_avg in load_averages]
        return load_averages
520605
private function _loadavg()
    {
        $load1 = $this->_kstat('unix:0:system_misc:avenrun_1min');
        $load5 = $this->_kstat('unix:0:system_misc:avenrun_5min');
        $load15 = $this->_kstat('unix:0:system_misc:avenrun_15min');
        $this->sys->setLoad(round($load1 / 256, 2).' '.round($load5 / 256, 2).' '.round($load15 / 256, 2));
    }
529832
function avgCpuLoad (span, cb) {
  if (typeof span !== 'number' || span < 0) span = 100
  var start = os.cpus()

  setTimeout(function avgCpuLoadCompare () {
    var totals = os.cpus().reduce(function (totals, end, i) {
      var busy = end.times.user + end.times.sys - start[i].times.user - start[i].times.sys
      totals.total += busy + end.times.idle - start[i].times.idle
      totals.busy += busy
      return totals
    }, {busy: 0, total: 0})

    cb(totals.busy / totals.total)
  }, span)
}
1285391
def check_critical_load(self):
        """"""
        if self.load_avg.intervals['1m'].value > 1:
            if self.last_load_level == 1 and time.time() - self.last_load_log < 30:
                return
            self.last_load_log = time.time()
            self.last_load_level = 1
            logger.error(
                "Listener load limit exceeded, the system can't handle this!",
                extra=self._make_stats()
            )

        elif self.load_avg.intervals['1m'].value > 0.8:
            if self.last_load_level == 0.8 and time.time() - self.last_load_log < 30:
                return
            self.last_load_log = time.time()
            self.last_load_level = 0.8
            logger.warning(
                "Listener load approaching critical!",
                extra=self._make_stats()
            )

        else:
            self.last_load_log = -math.inf
            self.last_load_level = 0
776683
def get_current(self, layout=None, network=None, verbose=False):
        
        PARAMS={}
        response=api(url=self.__url+"/get_current", PARAMS=PARAMS, method="POST", verbose=verbose)
        return response
707609
public function getLoad()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Load Averages');
        }

        // File that has it
        $file = '/proc/loadavg';

        // Get contents
        $contents = Common::getContents($file, false);

        // ugh
        if ($contents === false) {
            Errors::add('Linfo Core', '/proc/loadavg unreadable');
            return [];
        }

        // Parts
        $parts = array_slice(explode(' ', $contents), 0, 3);

        if (!$parts) {
            return [];
        }

        return array_combine(array('now', '5min', '15min'), $parts);
    }
659803
def html_load_time(self):
        
        load_times = self.get_load_times('html')
        return round(mean(load_times), self.decimal_precision)
1214053
public function current()
    {
        $this->currentData['stream'] = $this->repository->getBucket()->openDownloadStream($this->currentData['_id']);
        return parent::current();
    }
577924
private function _loadavg()
    {
        if (CommonFunctions::executeProgram('uptime', '', $buf)) {
            if (preg_match("/load averages: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
                $this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
            }
        }
    }
524576
def average():
    
    count = 0
    total = total()
    i=0
    while 1:
        i = yield ((total.send(i)*1.0)/count if count else 0)
        count += 1
561601
def current_consumption(self):
        """"""
        res = 'N/A'
        if self.use_legacy_protocol:
            # Use /my_cgi.cgi to retrieve current consumption
            try:
                res = self.fetchMyCgi()['Meter Watt']
            except:
                return 'N/A'
        else:
            try:
                res = self.SOAPAction('GetCurrentPowerConsumption', 'CurrentConsumption', self.moduleParameters("2"))
            except:
                return 'N/A'

        if res is None:
            return 'N/A'

        try:
            res = float(res)
        except ValueError:
            _LOGGER.error("Failed to retrieve current power consumption from SmartPlug")

        return res
1285753
def cmd_average_waiting_time(self):
        """"""
        average = [
            line.time_wait_queues
            for line in self._valid_lines
            if line.time_wait_queues >= 0
        ]

        divisor = float(len(average))
        if divisor > 0:
            return sum(average) / float(len(average))
        return 0
814225
public static int getTotalThreadCount() {
		ThreadGroup parentThread = Thread.currentThread().getThreadGroup();
		while(null != parentThread.getParent()) {
			parentThread = parentThread.getParent();
		}
		return parentThread.activeCount();
	}
644361
public function getLoad()
    {
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Load Averages');
        }

        $parts = explode(' ', trim($this->sysctl['vm.loadavg']));

        if (!$parts) {
            return [];
        }

        return array_combine(array('now', '5min', '15min'), $parts);
    }
453837
def total_consumption(self):
        """"""
        if self.use_legacy_protocol:
            # TotalConsumption currently fails on the legacy protocol and
            # creates a mess in the logs. Just return 'N/A' for now.
            return 'N/A'

        res = 'N/A'
        try:
            res = self.SOAPAction("GetPMWarningThreshold", "TotalConsumption", self.moduleParameters("2"))
        except:
            return 'N/A'

        if res is None:
            return 'N/A'

        try:
            float(res)
        except ValueError:
            _LOGGER.error("Failed to retrieve total power consumption from SmartPlug")

        return res
1208241
def mw(self):
        """"""
        m = P_TAB[self.symbol].get('std_weight')
        mh = P_TAB['H'].get('std_weight')
        return m + mh * self.H_count