title: Monitor cpu usage of multiple processes in Python
body: <p>Is there any way to monitor cpu usage of Linux processes in Python. I tried to import &quot;psutil&quot;, but for using function <code>process.cpu_percent()</code> you have to set interval as argument and it is not possible when I want info about multiple processes because it will take a lot of time.</p>
  <p>If you set argument as <code>interval=None</code> it returns value 0.0</p>
  <p>Example of code:</p>
  <pre><code>for pid in PIDs:
     p = psutil.Process(pid)
     print(p.cpu_percent(1))
  </code></pre>
  <p>If you have 1000 processes, it will take 1000 seconds and I need to have it immediately.</p>