项目作者: cptpcrd

项目描述 :
A partial reimplementation of psutil in pure Python using ctypes.
高级语言: Python
项目地址: git://github.com/cptpcrd/pypsutil.git
创建时间: 2020-08-04T02:04:23Z
项目社区:https://github.com/cptpcrd/pypsutil

开源协议:MIT License

下载


pypsutil

PyPI
Python Versions
Documentation Status
GitHub Actions
Cirrus CI
codecov

A partial reimplementation of psutil in pure Python using ctypes. Currently, only Linux, macOS, and the BSDs are supported, but Windows support is planned.

Documentation

Example usage

pypsutil‘s API is very similar to psutil‘s:

  1. >>> import pypsutil
  2. >>> p = pypsutil.Process()
  3. >>> p.pid
  4. 477967
  5. >>> p
  6. Process(pid=477967, name='python3', status='running', started='12:00:40')
  7. >>> p.name()
  8. 'python3'
  9. >>> p.exe()
  10. '/usr/bin/python3.9'
  11. >>> p.cwd()
  12. '/tmp'
  13. >>> p.cmdline()
  14. ['python3']
  15. >>> p.terminal()
  16. '/dev/pts/6'
  17. >>> p.status()
  18. <ProcessStatus.RUNNING: 'running'>
  19. >>> p.ppid()
  20. 477771
  21. >>> p.parent()
  22. Process(pid=477771, name='bash', status='sleeping', started='12:00:33')

More information is available in the documentation.