

def _estimate_cpu_utilization(self):
    'Estimates the cpu utilization within the last 500ms'
    now = time.time()
    if ((now - self._last_cpu_check) >= 0.5):
        try:
            self._last_cpu_usage = psutil.cpu_percent()
            self._last_cpu_check = now
        except (psutil.NoSuchProcess, ZeroDivisionError):
            pass
    return self._last_cpu_usage

dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/environment.py Environment._estimate_cpu_utilization/original