Skip to content Skip to sidebar Skip to footer

System Cpu Usage By User-python

Is there anyway that I can cross link all incoming users (netstat -a in CMD) to create a montior system to track the percentage of CPU used by each of the users in python. Does the

Solution 1:

It's not possible to figure out CPU usage per-user per-se. What you might do is figure out the CPU usages of processes owned by a certain user as in:

for p in psutil.process_iter():
    if p.username == 'someusername':
        print p.get_cpu_percent(interval=1)

Summing all of them in order to obtain a total is unlikely to produce a meaningful value though.

Post a Comment for "System Cpu Usage By User-python"