def cpu_times(percpu=False): """Return system-wide CPU times as a namedtuple object. Every CPU time represents the time CPU has spent in the given mode. The attributes availability varies depending on the platform. Here follows a list of all available attributes: - user - system - idle - nice (UNIX) - iowait (Linux) - irq (Linux, FreeBSD) - softirq (Linux) - steal (Linux >= 2.6.11) - guest (Linux >= 2.6.24) - guest_nice (Linux >= 3.2.0) When percpu is True return a list of nameduples for each CPU. First element of the list refers to first CPU, second element to second CPU and so on. The order of the list is consistent across calls. """ if not percpu: return _psplatform.get_system_cpu_times() else: return _psplatform.get_system_per_cpu_times()