summaryrefslogtreecommitdiff
path: root/server/pstat.py
blob: eed65288df7f0483d0f18763a8db03fe5945973d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3
import psutil, os, sys, time

t=time.clock_gettime(time.CLOCK_MONOTONIC)

for p in psutil.process_iter():
    try:
        with p.oneshot():
            print(p.pid,p.username(),p.name(),p.memory_info().rss,p.cpu_times())
    except Exception as e:
        pass

t=time.clock_gettime(time.CLOCK_MONOTONIC)-t
print(t,file=sys.stderr)