TODO 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. TODO
  2. ====
  3. A collection of ideas and notes about stuff to implement in future versions.
  4. "#NNN" occurrences refer to bug tracker issues at:
  5. https://github.com/giampaolo/psutil/issues
  6. HIGHER PRIORITY
  7. ===============
  8. * OpenBSD support.
  9. * #371: CPU temperature (apparently OSX and Linux only; on Linux it requires
  10. lm-sensors lib).
  11. * #269: expose network ifaces RX/TW queues. This should probably go into
  12. net_if_stats(). Figure out on what platforms this is supported:
  13. Linux: yes
  14. Others: ?
  15. * Process.threads(): thread names; patch for OSX available at:
  16. https://code.google.com/p/plcrashreporter/issues/detail?id=65
  17. * Asynchronous psutil.Popen (see http://bugs.python.org/issue1191964)
  18. * (Windows) fall back on using WMIC for Process methods returning AccessDenied
  19. * #613: thread names.
  20. * #604: emulate os.getloadavg() on Windows
  21. * #269: NIC rx/tx queue.
  22. LOWER PRIORITY
  23. ==============
  24. * #355: Android support.
  25. * #276: GNU/Hurd support.
  26. * #429: NetBSD support.
  27. * DragonFlyBSD support?
  28. * AIX support?
  29. * examples/taskmgr-gui.py (using tk).
  30. * system-wide number of open file descriptors:
  31. * https://jira.hyperic.com/browse/SIGAR-30
  32. * http://www.netadmintools.com/part295.html
  33. * Number of system threads.
  34. * Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684824(v=vs.85).aspx
  35. * #357: what CPU a process is on.
  36. * Doc / wiki which compares similarities between UNIX cli tools and psutil.
  37. Example:
  38. df -a -> psutil.disk_partitions
  39. lsof -> psutil.Process.open_files() and psutil.Process.open_connections()
  40. killall-> (actual script)
  41. tty -> psutil.Process.terminal()
  42. who -> psutil.users()
  43. DEBATABLE
  44. =========
  45. * psutil.proc_tree() something which obtains a {pid:ppid, ...} dict for
  46. all running processes in one shot. This can be factored out from
  47. Process.children() and exposed as a first class function.
  48. PROS: on Windows we can take advantage of _psutil_windows.ppid_map()
  49. which is faster than iterating over all pids and calling ppid().
  50. CONS: examples/pstree.py shows this can be easily done in the user code
  51. so maybe it's not worth the addition.
  52. * advanced cmdline interface exposing the whole API and providing different
  53. kind of outputs (e.g. pprinted, colorized, json).
  54. * [Linux]: process cgroups (http://en.wikipedia.org/wiki/Cgroups). They look
  55. similar to prlimit() in terms of functionality but uglier (they should allow
  56. limiting per-process network IO resources though, which is great). Needs
  57. further reading.
  58. * Should we expose OS constants (psutil.WINDOWS, psutil.OSX etc.)?
  59. * Python 3.3. exposed different sched.h functions:
  60. http://docs.python.org/dev/whatsnew/3.3.html#os
  61. http://bugs.python.org/issue12655
  62. http://docs.python.org/dev/library/os.html#interface-to-the-scheduler
  63. It might be worth to take a look and figure out whether we can include some
  64. of those in psutil.
  65. Also, we can probably reimplement wait_pid() on POSIX which is currently
  66. implemented as a busy-loop.
  67. * Certain systems provide CPU times about process children. On those systems
  68. Process.cpu_times() might return a (user, system, user_children,
  69. system_children) ntuple.
  70. * Linux: /proc/{PID}/stat
  71. * Solaris: pr_cutime and pr_cstime
  72. * FreeBSD: none
  73. * OSX: none
  74. * Windows: none
  75. * ...also, os.times() provides 'elapsed' times as well.
  76. * ...also Linux provides guest_time and cguest_time.
  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. * Process.threads() might grow an extra "id" parameter so that it can be
  83. used as such:
  84. >>> p = psutil.Process(os.getpid())
  85. >>> p.threads(id=psutil.current_thread_id())
  86. thread(id=2539, user_time=0.03, system_time=0.02)
  87. >>>
  88. Note: this leads to questions such as "should we have a custom NoSuchThread
  89. exception? Also see issue #418.
  90. Note #2: this would work with os.getpid() only.
  91. psutil.current_thread_id() might be desirable as per issue #418 though.
  92. * should psutil.TimeoutExpired exception have a 'msg' kwarg similar to
  93. NoSuchProcess and AccessDenied? Not that we need it, but currently we
  94. cannot raise a TimeoutExpired exception with a specific error string.
  95. * process_iter() might grow an "attrs" parameter similar to Process.as_dict()
  96. invoke the necessary methods and include the results into a "cache"
  97. attribute attached to the returned Process instances so that one can avoid
  98. catching NSP and AccessDenied:
  99. for p in process_iter(attrs=['cpu_percent']):
  100. print(p.cache['cpu_percent'])
  101. This also leads questions as whether we should introduce a sorting order.
  102. * round Process.memory_percent() result?
  103. * #550: number of threads per core.
  104. * Have psutil.Process().cpu_affinity([]) be an alias for "all CPUs"?
  105. COMPATIBILITY BREAKAGE
  106. ======================
  107. Removals (will likely happen in 2.2):
  108. * (S) psutil.Process.nice (deprecated in 0.5.0)
  109. * (S) get_process_list (deprecated in 0.5.0)
  110. * (S) psutil.*mem* functions (deprecated in 0.3.0 and 0.6.0)
  111. * (M) psutil.network_io_counters (deprecated in 1.0.0)
  112. * (M) local_address and remote_address Process.connection() namedtuple fields
  113. (deprecated in 1.0.0)
  114. REJECTED IDEAS
  115. ==============
  116. STUB