psutil

Форк
0
/
DEVNOTES 
129 строк · 4.4 Кб
1
TODO
2
====
3

4
A collection of ideas and notes about stuff to implement in future versions.
5
"#NNN" occurrences refer to bug tracker issues at:
6
https://github.com/giampaolo/psutil/issues
7

8
FEATURES
9
========
10

11
- (UNIX) process root (different from cwd)
12

13
- (Linux) locked files via /proc/locks:
14
  https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-proc-locks.html
15

16
- #269: NIC rx/tx queue. This should probably go into net_if_stats().
17
  Figure out on what platforms this is supported:
18
  Linux: yes
19
  Others: ?
20

21
- Asynchronous psutil.Popen (see http://bugs.python.org/issue1191964)
22

23
- (Windows) fall back on using WMIC for Process methods returning AccessDenied
24

25
- #613: thread names; patch for macOS available at:
26
  https://code.google.com/p/plcrashreporter/issues/detail?id=65
27
  Sample code:
28
  https://github.com/janmojzis/pstree/blob/master/proc_kvm.c
29

30
- scripts/taskmgr-gui.py (using tk).
31

32
- system-wide number of open file descriptors:
33
  - https://jira.hyperic.com/browse/SIGAR-30
34

35
- Number of system threads.
36
  - Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684824(v=vs.85).aspx
37

38
- Doc / wiki which compares similarities between UNIX cli tools and psutil.
39
  Example:
40
  ```
41
  df -a  ->  psutil.disk_partitions
42
  lsof  ->  psutil.Process.open_files() and psutil.Process.net_connections()
43
  killall->  (actual script)
44
  tty  ->  psutil.Process.terminal()
45
  who  ->  psutil.users()
46
  ```
47

48
- psutil.proc_tree() something which obtains a {pid:ppid, ...} dict for
49
  all running processes in one shot. This can be factored out from
50
  Process.children() and exposed as a first class function.
51
  PROS: on Windows we can take advantage of _psutil_windows.ppid_map()
52
  which is faster than iterating over all pids and calling ppid().
53
  CONS: scripts/pstree.py shows this can be easily done in the user code
54
  so maybe it's not worth the addition.
55

56
- advanced cmdline interface exposing the whole API and providing different
57
  kind of outputs (e.g. pprinted, colorized, json).
58

59
- [Linux]: process cgroups (http://en.wikipedia.org/wiki/Cgroups). They look
60
  similar to prlimit() in terms of functionality but uglier (they should allow
61
  limiting per-process network IO resources though, which is great). Needs
62
  further reading.
63

64
- Python 3.3. exposed different sched.h functions:
65
  http://docs.python.org/dev/whatsnew/3.3.html#os
66
  http://bugs.python.org/issue12655
67
  http://docs.python.org/dev/library/os.html#interface-to-the-scheduler
68
  It might be worth to take a look and figure out whether we can include some
69
  of those in psutil.
70
  Also, we can probably reimplement wait_pid() on POSIX which is currently
71
  implemented as a busy-loop.
72

73
- os.times() provides 'elapsed' times (cpu_times() might).
74

75
- ...also guest_time and cguest_time on Linux.
76

77
- Enrich exception classes hierarchy on Python >= 3.3 / post PEP-3151 so that:
78
   - NoSuchProcess inherits from ProcessLookupError
79
   - AccessDenied inherits from PermissionError
80
   - TimeoutExpired inherits from TimeoutError (debatable)
81
   See: http://docs.python.org/3/library/exceptions.html#os-exceptions
82

83
- Process.threads() might grow an extra "id" parameter so that it can be
84
   used as such:
85
  ```
86
  >>> p = psutil.Process(os.getpid())
87
  >>> p.threads(id=psutil.current_thread_id())
88
  thread(id=2539, user_time=0.03, system_time=0.02)
89
  >>>
90
  ```
91
  Note: this leads to questions such as "should we have a custom NoSuchThread
92
  exception? Also see issue #418.
93
  Note #2: this would work with os.getpid() only.
94
  psutil.current_thread_id() might be desirable as per issue #418 though.
95

96
- should psutil.TimeoutExpired exception have a 'msg' kwarg similar to
97
  NoSuchProcess and AccessDenied? Not that we need it, but currently we
98
  cannot raise a TimeoutExpired exception with a specific error string.
99

100
- round Process.memory_percent() result?
101

102
BUGFIXES
103
========
104

105
- #600: windows / open_files(): support network file handles.
106

107
REJECTED IDEAS
108
==============
109

110
- #550: threads per core
111
- #1667: process_iter(new_only=True)
112

113
INCONSISTENCIES
114
===============
115

116
- PROCFS_PATH should have been set_procfs_path().
117
- `virtual_memory()` should have been `memory_virtual()`.
118
- `swap_memory()` should have been `memory_swap()`.
119

120
RESOURCES
121
=========
122

123
- conky: https://github.com/brndnmtthws/conky/
124
- sigar: https://github.com/hyperic/sigar (Java)
125
- zabbix: https://zabbix.org/wiki/Get_Zabbix
126
- libstatgrab: http://www.i-scream.org/libstatgrab/
127
- top: http://www.unixtop.org/
128
- oshi: https://github.com/oshi/oshi
129
- netdata: https://github.com/netdata/netdata
130

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.