예제 #1
0
    def get(self, estimate=False):
        while True:
            current = SystemCpuLoadValue()
            last = self.searchLast(current)
            if last:
                break
            if estimate:
                return None
            else:
                sleep(SYSLOAD_SLEEP)

        # Store value
        self.datas.append(current)

        # Compute system load: 100% - idle percent
        data = listDiff(last.data, current.data)
        load = 1.0 - float(data[3]) / sum(data)
        return load
예제 #2
0
    def get(self, estimate=False):
        while True:
            current = SystemCpuLoadValue()
            last = self.searchLast(current)
            if last:
                break
            if estimate:
                return None
            else:
                sleep(SYSLOAD_SLEEP)

        # Store value
        self.datas.append(current)

        # Compute system load: 100% - idle percent
        data = listDiff(last.data, current.data)
        load = 1.0 - float(data[3]) / sum(data)
        return load
예제 #3
0
 def isValid(self, item, current):
     data = listDiff(item.data, current.data)
     return (self.min_cycles <= sum(data)) \
         and (self.min_duration < current.timestamp - item.timestamp)
예제 #4
0
 def isValid(self, item, current):
     data = listDiff(item.data, current.data)
     return (self.min_cycles <= sum(data)) \
         and (self.min_duration < current.timestamp - item.timestamp)