File: taskstats.py

package info (click to toggle)
pyroute2 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,700 kB
  • sloc: python: 50,245; makefile: 280; javascript: 183; ansic: 81; sh: 44; awk: 17
file content (14 lines) | stat: -rw-r--r-- 246 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
'''
Simple taskstats sample.
'''
import os
from pyroute2 import TaskStats

pid = os.getpid()
ts = TaskStats()
# bind is required in the case of generic netlink
ts.bind()
ret = ts.get_pid_stat(int(pid))[0]
# parsed structure
print(ret)
ts.close()