{"id":13459231,"url":"https://github.com/giampaolo/psutil","last_synced_at":"2025-05-12T16:13:03.660Z","repository":{"id":17330450,"uuid":"20101515","full_name":"giampaolo/psutil","owner":"giampaolo","description":"Cross-platform lib for process and system monitoring in Python","archived":false,"fork":false,"pushed_at":"2025-05-03T13:48:24.000Z","size":37210,"stargazers_count":10610,"open_issues_count":339,"forks_count":1403,"subscribers_count":230,"default_branch":"master","last_synced_at":"2025-05-05T14:10:35.304Z","etag":null,"topics":["cpu","disk","freebsd","linux","memory","monitoring","netbsd","openbsd","osx","ps","psutil","python","sensors","system-monitoring","top","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giampaolo.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"tidelift":"pypi/psutil","github":"giampaolo","patreon":null,"open_collective":"psutil","ko_fi":null,"community_bridge":null,"custom":"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=A9ZS7PKKRM3S8"}},"created_at":"2014-05-23T14:01:48.000Z","updated_at":"2025-05-05T09:53:45.000Z","dependencies_parsed_at":"2023-02-19T06:46:03.860Z","dependency_job_id":"c5b47075-8bf7-476b-b20e-3fc1d06e9860","html_url":"https://github.com/giampaolo/psutil","commit_stats":{"total_commits":5580,"total_committers":214,"mean_commits":"26.074766355140188","dds":0.1480286738351254,"last_synced_commit":"fb68f9fae3b398899d87161746884ebb2a2613c0"},"previous_names":[],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giampaolo%2Fpsutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giampaolo%2Fpsutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giampaolo%2Fpsutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giampaolo%2Fpsutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giampaolo","download_url":"https://codeload.github.com/giampaolo/psutil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973690,"owners_count":21834108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpu","disk","freebsd","linux","memory","monitoring","netbsd","openbsd","osx","ps","psutil","python","sensors","system-monitoring","top","windows"],"created_at":"2024-07-31T09:01:11.352Z","updated_at":"2025-05-12T16:13:03.610Z","avatar_url":"https://github.com/giampaolo.png","language":"Python","readme":"|  |downloads| |stars| |forks| |contributors| |coverage|\n|  |version| |py-versions| |packages| |license|\n|  |github-actions-wheels|  |github-actions-bsd| |doc| |twitter| |tidelift|\n\n.. |downloads| image:: https://img.shields.io/pypi/dm/psutil.svg\n    :target: https://pepy.tech/project/psutil\n    :alt: Downloads\n\n.. |stars| image:: https://img.shields.io/github/stars/giampaolo/psutil.svg\n    :target: https://github.com/giampaolo/psutil/stargazers\n    :alt: Github stars\n\n.. |forks| image:: https://img.shields.io/github/forks/giampaolo/psutil.svg\n    :target: https://github.com/giampaolo/psutil/network/members\n    :alt: Github forks\n\n.. |contributors| image:: https://img.shields.io/github/contributors/giampaolo/psutil.svg\n    :target: https://github.com/giampaolo/psutil/graphs/contributors\n    :alt: Contributors\n\n.. |github-actions-wheels| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/build.yml.svg?label=Linux%2C%20macOS%2C%20Windows\n    :target: https://github.com/giampaolo/psutil/actions?query=workflow%3Abuild\n    :alt: Linux, macOS, Windows\n\n.. |github-actions-bsd| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/bsd.yml.svg?label=FreeBSD,%20NetBSD,%20OpenBSD\n    :target: https://github.com/giampaolo/psutil/actions?query=workflow%3Absd-tests\n    :alt: FreeBSD, NetBSD, OpenBSD\n\n.. |coverage| image:: https://coveralls.io/repos/github/giampaolo/psutil/badge.svg?branch=master\n    :target: https://coveralls.io/github/giampaolo/psutil?branch=master\n    :alt: Test coverage (coverall.io)\n\n.. |doc| image:: https://readthedocs.org/projects/psutil/badge/?version=latest\n    :target: https://psutil.readthedocs.io/en/latest/\n    :alt: Documentation Status\n\n.. |version| image:: https://img.shields.io/pypi/v/psutil.svg?label=pypi\n    :target: https://pypi.org/project/psutil\n    :alt: Latest version\n\n.. |py-versions| image:: https://img.shields.io/pypi/pyversions/psutil.svg\n    :alt: Supported Python versions\n\n.. |packages| image:: https://repology.org/badge/tiny-repos/python:psutil.svg\n    :target: https://repology.org/metapackage/python:psutil/versions\n    :alt: Binary packages\n\n.. |license| image:: https://img.shields.io/pypi/l/psutil.svg\n    :target: https://github.com/giampaolo/psutil/blob/master/LICENSE\n    :alt: License\n\n.. |twitter| image:: https://img.shields.io/twitter/follow/grodola.svg?label=follow\u0026style=flat\u0026logo=twitter\u0026logoColor=4FADFF\n    :target: https://twitter.com/grodola\n    :alt: Twitter Follow\n\n.. |tidelift| image:: https://tidelift.com/badges/github/giampaolo/psutil?style=flat\n    :target: https://tidelift.com/subscription/pkg/pypi-psutil?utm_source=pypi-psutil\u0026utm_medium=referral\u0026utm_campaign=readme\n    :alt: Tidelift\n\n-----\n\n.. raw:: html\n\n    \u003cdiv align=\"center\"\u003e\n        \u003ca href=\"https://github.com/giampaolo/psutil\"\u003e\u003cimg src=\"https://github.com/giampaolo/psutil/raw/master/docs/_static/psutil-logo.png\" /\u003e\u003c/a\u003e\n        \u003cbr /\u003e\n        \u003cbr /\u003e\n        \u003ca href=\"https://github.com/giampaolo/psutil\"\u003e\u003cb\u003eHome\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://github.com/giampaolo/psutil/blob/master/INSTALL.rst\"\u003e\u003cb\u003eInstall\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://psutil.readthedocs.io/\"\u003e\u003cb\u003eDocumentation\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://pypi.org/project/psutil/#files\"\u003e\u003cb\u003eDownload\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://groups.google.com/g/psutil\"\u003e\u003cb\u003eForum\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://gmpy.dev/tags/psutil\"\u003e\u003cb\u003eBlog\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"#funding\"\u003e\u003cb\u003eFunding\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n        \u003ca href=\"https://github.com/giampaolo/psutil/blob/master/HISTORY.rst\"\u003e\u003cb\u003eWhat's new\u003c/b\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\n    \u003c/div\u003e\n\nSummary\n=======\n\npsutil (process and system utilities) is a cross-platform library for\nretrieving information on **running processes** and **system utilization**\n(CPU, memory, disks, network, sensors) in Python.\nIt is useful mainly for **system monitoring**, **profiling and limiting process\nresources** and **management of running processes**.\nIt implements many functionalities offered by classic UNIX command line tools\nsuch as *ps, top, iotop, lsof, netstat, ifconfig, free* and others.\npsutil currently supports the following platforms:\n\n- **Linux**\n- **Windows**\n- **macOS**\n- **FreeBSD, OpenBSD**, **NetBSD**\n- **Sun Solaris**\n- **AIX**\n\nSupported Python versions are cPython 3.6+ and `PyPy \u003chttps://pypy.org/\u003e`__.\nLatest psutil version supporting Python 2.7 is\n`psutil 6.1.1 \u003chttps://pypi.org/project/psutil/6.1.1/\u003e`__.\n\nFunding\n=======\n\nWhile psutil is free software and will always be, the project would benefit\nimmensely from some funding.\nKeeping up with bug reports and maintenance has become hardly sustainable for\nme alone in terms of time.\nIf you're a company that's making significant use of psutil you can consider\nbecoming a sponsor via `GitHub Sponsors \u003chttps://github.com/sponsors/giampaolo\u003e`__,\n`Open Collective \u003chttps://opencollective.com/psutil\u003e`__ or\n`PayPal \u003chttps://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=A9ZS7PKKRM3S8\u003e`__\nand have your logo displayed in here and psutil `doc \u003chttps://psutil.readthedocs.io\u003e`__.\n\nSponsors\n========\n\n.. raw:: html\n\n    \u003cdiv\u003e\n        \u003ca href=\"https://tidelift.com/subscription/pkg/pypi-psutil?utm_source=pypi-psutil\u0026utm_medium=referral\u0026utm_campaign=readme\"\u003e\n            \u003cimg width=\"185\" src=\"https://github.com/giampaolo/psutil/raw/master/docs/_static/tidelift-logo.svg\" /\u003e\n        \u003c/a\u003e\n        \u0026nbsp;\u0026nbsp\n        \u003ca href=\"https://sansec.io/\"\u003e\n            \u003cimg src=\"https://sansec.io/assets/images/logo.svg\" /\u003e\n        \u003c/a\u003e\n    \u003c/div\u003e\n    \u003csup\u003e\u003ca href=\"https://github.com/sponsors/giampaolo\"\u003eadd your logo\u003c/a\u003e\u003c/sup\u003e\n\nSupporters\n==========\n\n.. raw:: html\n\n    \u003cdiv\u003e\n      \u003ca href=\"https://github.com/dbwiddis\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Daniel Widdis\" src=\"https://avatars1.githubusercontent.com/u/9291703?s=88\u0026amp;v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/aristocratos\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"aristocratos\" src=\"https://avatars3.githubusercontent.com/u/59659483?s=96\u0026amp;v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/cybersecgeek\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"cybersecgeek\" src=\"https://avatars.githubusercontent.com/u/12847926?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/scoutapm-sponsorships\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"scoutapm-sponsorships\" src=\"https://avatars.githubusercontent.com/u/71095532?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://opencollective.com/chenyoo-hao\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Chenyoo Hao\" src=\"https://images.opencollective.com/chenyoo-hao/avatar/40.png\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://opencollective.com/alexey-vazhnov\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Alexey Vazhnov\" src=\"https://images.opencollective.com/alexey-vazhnov/daed334/avatar/40.png\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/indeedeng\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"indeedeng\" src=\"https://avatars.githubusercontent.com/u/2905043?s=200\u0026v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/PySimpleGUI\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"PySimpleGUI\" src=\"https://avatars.githubusercontent.com/u/46163555?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/u93\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Eugenio E Breijo\" src=\"https://avatars.githubusercontent.com/u/16807302?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/guilt\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Karthik Kumar Viswanathan\" src=\"https://avatars.githubusercontent.com/u/195178?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/eallrich\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Evan Allrich\" src=\"https://avatars.githubusercontent.com/u/17393?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/robusta-dev\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"Robusta\" src=\"https://avatars.githubusercontent.com/u/82757710?s=200\u0026v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/JeremyGrosser\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"JeremyGrosser\" src=\"https://avatars.githubusercontent.com/u/2151?v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/getsentry\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"getsentry\" src=\"https://avatars.githubusercontent.com/u/1396951?s=200\u0026v=4\" /\u003e\u003c/a\u003e\n      \u003ca href=\"https://github.com/c0m4r\"\u003e\u003cimg height=\"40\" width=\"40\" title=\"c0m4r\" src=\"https://avatars.githubusercontent.com/u/6292788?v=4\" /\u003e\u003c/a\u003e\n\n    \u003c/div\u003e\n    \u003csup\u003e\u003ca href=\"https://github.com/sponsors/giampaolo\"\u003eadd your avatar\u003c/a\u003e\u003c/sup\u003e\n\n\nContributing\n============\n\nSee `contributing guidelines \u003chttps://github.com/giampaolo/psutil/blob/master/CONTRIBUTING.md\u003e`__.\n\nExample usages\n==============\n\nThis represents pretty much the whole psutil API.\n\nCPU\n---\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import psutil\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.cpu_times()\n    scputimes(user=3961.46, nice=169.729, system=2150.659, idle=16900.540, iowait=629.59, irq=0.0, softirq=19.42, steal=0.0, guest=0, guest_nice=0.0)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e for x in range(3):\n    ...     psutil.cpu_percent(interval=1)\n    ...\n    4.0\n    5.9\n    3.8\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e for x in range(3):\n    ...     psutil.cpu_percent(interval=1, percpu=True)\n    ...\n    [4.0, 6.9, 3.7, 9.2]\n    [7.0, 8.5, 2.4, 2.1]\n    [1.2, 9.0, 9.9, 7.2]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e for x in range(3):\n    ...     psutil.cpu_times_percent(interval=1, percpu=False)\n    ...\n    scputimes(user=1.5, nice=0.0, system=0.5, idle=96.5, iowait=1.5, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)\n    scputimes(user=1.0, nice=0.0, system=0.0, idle=99.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)\n    scputimes(user=2.0, nice=0.0, system=0.0, idle=98.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.cpu_count()\n    4\n    \u003e\u003e\u003e psutil.cpu_count(logical=False)\n    2\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.cpu_stats()\n    scpustats(ctx_switches=20455687, interrupts=6598984, soft_interrupts=2134212, syscalls=0)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.cpu_freq()\n    scpufreq(current=931.42925, min=800.0, max=3500.0)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.getloadavg()  # also on Windows (emulated)\n    (3.14, 3.89, 4.67)\n\nMemory\n------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e psutil.virtual_memory()\n    svmem(total=10367352832, available=6472179712, percent=37.6, used=8186245120, free=2181107712, active=4748992512, inactive=2758115328, buffers=790724608, cached=3500347392, shared=787554304)\n    \u003e\u003e\u003e psutil.swap_memory()\n    sswap(total=2097147904, used=296128512, free=1801019392, percent=14.1, sin=304193536, sout=677842944)\n    \u003e\u003e\u003e\n\nDisks\n-----\n\n.. code-block:: python\n\n    \u003e\u003e\u003e psutil.disk_partitions()\n    [sdiskpart(device='/dev/sda1', mountpoint='/', fstype='ext4', opts='rw,nosuid'),\n     sdiskpart(device='/dev/sda2', mountpoint='/home', fstype='ext', opts='rw')]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.disk_usage('/')\n    sdiskusage(total=21378641920, used=4809781248, free=15482871808, percent=22.5)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.disk_io_counters(perdisk=False)\n    sdiskio(read_count=719566, write_count=1082197, read_bytes=18626220032, write_bytes=24081764352, read_time=5023392, write_time=63199568, read_merged_count=619166, write_merged_count=812396, busy_time=4523412)\n    \u003e\u003e\u003e\n\nNetwork\n-------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e psutil.net_io_counters(pernic=True)\n    {'eth0': netio(bytes_sent=485291293, bytes_recv=6004858642, packets_sent=3251564, packets_recv=4787798, errin=0, errout=0, dropin=0, dropout=0),\n     'lo': netio(bytes_sent=2838627, bytes_recv=2838627, packets_sent=30567, packets_recv=30567, errin=0, errout=0, dropin=0, dropout=0)}\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.net_connections(kind='tcp')\n    [sconn(fd=115, family=\u003cAddressFamily.AF_INET: 2\u003e, type=\u003cSocketType.SOCK_STREAM: 1\u003e, laddr=addr(ip='10.0.0.1', port=48776), raddr=addr(ip='93.186.135.91', port=80), status='ESTABLISHED', pid=1254),\n     sconn(fd=117, family=\u003cAddressFamily.AF_INET: 2\u003e, type=\u003cSocketType.SOCK_STREAM: 1\u003e, laddr=addr(ip='10.0.0.1', port=43761), raddr=addr(ip='72.14.234.100', port=80), status='CLOSING', pid=2987),\n     ...]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.net_if_addrs()\n    {'lo': [snicaddr(family=\u003cAddressFamily.AF_INET: 2\u003e, address='127.0.0.1', netmask='255.0.0.0', broadcast='127.0.0.1', ptp=None),\n            snicaddr(family=\u003cAddressFamily.AF_INET6: 10\u003e, address='::1', netmask='ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', broadcast=None, ptp=None),\n            snicaddr(family=\u003cAddressFamily.AF_LINK: 17\u003e, address='00:00:00:00:00:00', netmask=None, broadcast='00:00:00:00:00:00', ptp=None)],\n     'wlan0': [snicaddr(family=\u003cAddressFamily.AF_INET: 2\u003e, address='192.168.1.3', netmask='255.255.255.0', broadcast='192.168.1.255', ptp=None),\n               snicaddr(family=\u003cAddressFamily.AF_INET6: 10\u003e, address='fe80::c685:8ff:fe45:641%wlan0', netmask='ffff:ffff:ffff:ffff::', broadcast=None, ptp=None),\n               snicaddr(family=\u003cAddressFamily.AF_LINK: 17\u003e, address='c4:85:08:45:06:41', netmask=None, broadcast='ff:ff:ff:ff:ff:ff', ptp=None)]}\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.net_if_stats()\n    {'lo': snicstats(isup=True, duplex=\u003cNicDuplex.NIC_DUPLEX_UNKNOWN: 0\u003e, speed=0, mtu=65536, flags='up,loopback,running'),\n     'wlan0': snicstats(isup=True, duplex=\u003cNicDuplex.NIC_DUPLEX_FULL: 2\u003e, speed=100, mtu=1500, flags='up,broadcast,running,multicast')}\n    \u003e\u003e\u003e\n\nSensors\n-------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import psutil\n    \u003e\u003e\u003e psutil.sensors_temperatures()\n    {'acpitz': [shwtemp(label='', current=47.0, high=103.0, critical=103.0)],\n     'asus': [shwtemp(label='', current=47.0, high=None, critical=None)],\n     'coretemp': [shwtemp(label='Physical id 0', current=52.0, high=100.0, critical=100.0),\n                  shwtemp(label='Core 0', current=45.0, high=100.0, critical=100.0)]}\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.sensors_fans()\n    {'asus': [sfan(label='cpu_fan', current=3200)]}\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.sensors_battery()\n    sbattery(percent=93, secsleft=16628, power_plugged=False)\n    \u003e\u003e\u003e\n\nOther system info\n-----------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import psutil\n    \u003e\u003e\u003e psutil.users()\n    [suser(name='giampaolo', terminal='pts/2', host='localhost', started=1340737536.0, pid=1352),\n     suser(name='giampaolo', terminal='pts/3', host='localhost', started=1340737792.0, pid=1788)]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.boot_time()\n    1365519115.0\n    \u003e\u003e\u003e\n\nProcess management\n------------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import psutil\n    \u003e\u003e\u003e psutil.pids()\n    [1, 2, 3, 4, 5, 6, 7, 46, 48, 50, 51, 178, 182, 222, 223, 224, 268, 1215,\n     1216, 1220, 1221, 1243, 1244, 1301, 1601, 2237, 2355, 2637, 2774, 3932,\n     4176, 4177, 4185, 4187, 4189, 4225, 4243, 4245, 4263, 4282, 4306, 4311,\n     4312, 4313, 4314, 4337, 4339, 4357, 4358, 4363, 4383, 4395, 4408, 4433,\n     4443, 4445, 4446, 5167, 5234, 5235, 5252, 5318, 5424, 5644, 6987, 7054,\n     7055, 7071]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p = psutil.Process(7055)\n    \u003e\u003e\u003e p\n    psutil.Process(pid=7055, name='python3', status='running', started='09:04:44')\n    \u003e\u003e\u003e p.pid\n    7055\n    \u003e\u003e\u003e p.name()\n    'python3'\n    \u003e\u003e\u003e p.exe()\n    '/usr/bin/python3'\n    \u003e\u003e\u003e p.cwd()\n    '/home/giampaolo'\n    \u003e\u003e\u003e p.cmdline()\n    ['/usr/bin/python3', 'main.py']\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.ppid()\n    7054\n    \u003e\u003e\u003e p.parent()\n    psutil.Process(pid=4699, name='bash', status='sleeping', started='09:06:44')\n    \u003e\u003e\u003e p.parents()\n    [psutil.Process(pid=4699, name='bash', started='09:06:44'),\n     psutil.Process(pid=4689, name='gnome-terminal-server', status='sleeping', started='0:06:44'),\n     psutil.Process(pid=1, name='systemd', status='sleeping', started='05:56:55')]\n    \u003e\u003e\u003e p.children(recursive=True)\n    [psutil.Process(pid=29835, name='python3', status='sleeping', started='11:45:38'),\n     psutil.Process(pid=29836, name='python3', status='waking', started='11:43:39')]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.status()\n    'running'\n    \u003e\u003e\u003e p.create_time()\n    1267551141.5019531\n    \u003e\u003e\u003e p.terminal()\n    '/dev/pts/0'\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.username()\n    'giampaolo'\n    \u003e\u003e\u003e p.uids()\n    puids(real=1000, effective=1000, saved=1000)\n    \u003e\u003e\u003e p.gids()\n    pgids(real=1000, effective=1000, saved=1000)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.cpu_times()\n    pcputimes(user=1.02, system=0.31, children_user=0.32, children_system=0.1, iowait=0.0)\n    \u003e\u003e\u003e p.cpu_percent(interval=1.0)\n    12.1\n    \u003e\u003e\u003e p.cpu_affinity()\n    [0, 1, 2, 3]\n    \u003e\u003e\u003e p.cpu_affinity([0, 1])  # set\n    \u003e\u003e\u003e p.cpu_num()\n    1\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.memory_info()\n    pmem(rss=10915840, vms=67608576, shared=3313664, text=2310144, lib=0, data=7262208, dirty=0)\n    \u003e\u003e\u003e p.memory_full_info()  # \"real\" USS memory usage (Linux, macOS, Win only)\n    pfullmem(rss=10199040, vms=52133888, shared=3887104, text=2867200, lib=0, data=5967872, dirty=0, uss=6545408, pss=6872064, swap=0)\n    \u003e\u003e\u003e p.memory_percent()\n    0.7823\n    \u003e\u003e\u003e p.memory_maps()\n    [pmmap_grouped(path='/lib/x8664-linux-gnu/libutil-2.15.so', rss=32768, size=2125824, pss=32768, shared_clean=0, shared_dirty=0, private_clean=20480, private_dirty=12288, referenced=32768, anonymous=12288, swap=0),\n     pmmap_grouped(path='/lib/x8664-linux-gnu/libc-2.15.so', rss=3821568, size=3842048, pss=3821568, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=3821568, referenced=3575808, anonymous=3821568, swap=0),\n     pmmap_grouped(path='[heap]',  rss=32768, size=139264, pss=32768, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=32768, referenced=32768, anonymous=32768, swap=0),\n     pmmap_grouped(path='[stack]', rss=2465792, size=2494464, pss=2465792, shared_clean=0, shared_dirty=0, private_clean=0, private_dirty=2465792, referenced=2277376, anonymous=2465792, swap=0),\n     ...]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.io_counters()\n    pio(read_count=478001, write_count=59371, read_bytes=700416, write_bytes=69632, read_chars=456232, write_chars=517543)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.open_files()\n    [popenfile(path='/home/giampaolo/monit.py', fd=3, position=0, mode='r', flags=32768),\n     popenfile(path='/var/log/monit.log', fd=4, position=235542, mode='a', flags=33793)]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.net_connections(kind='tcp')\n    [pconn(fd=115, family=\u003cAddressFamily.AF_INET: 2\u003e, type=\u003cSocketType.SOCK_STREAM: 1\u003e, laddr=addr(ip='10.0.0.1', port=48776), raddr=addr(ip='93.186.135.91', port=80), status='ESTABLISHED'),\n     pconn(fd=117, family=\u003cAddressFamily.AF_INET: 2\u003e, type=\u003cSocketType.SOCK_STREAM: 1\u003e, laddr=addr(ip='10.0.0.1', port=43761), raddr=addr(ip='72.14.234.100', port=80), status='CLOSING')]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.threads()\n    [pthread(id=5234, user_time=22.5, system_time=9.2891),\n     pthread(id=5237, user_time=0.0707, system_time=1.1)]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.num_threads()\n    4\n    \u003e\u003e\u003e p.num_fds()\n    8\n    \u003e\u003e\u003e p.num_ctx_switches()\n    pctxsw(voluntary=78, involuntary=19)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.nice()\n    0\n    \u003e\u003e\u003e p.nice(10)  # set\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.ionice(psutil.IOPRIO_CLASS_IDLE)  # IO priority (Win and Linux only)\n    \u003e\u003e\u003e p.ionice()\n    pionice(ioclass=\u003cIOPriority.IOPRIO_CLASS_IDLE: 3\u003e, value=0)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.rlimit(psutil.RLIMIT_NOFILE, (5, 5))  # set resource limits (Linux only)\n    \u003e\u003e\u003e p.rlimit(psutil.RLIMIT_NOFILE)\n    (5, 5)\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.environ()\n    {'LC_PAPER': 'it_IT.UTF-8', 'SHELL': '/bin/bash', 'GREP_OPTIONS': '--color=auto',\n    'XDG_CONFIG_DIRS': '/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg',\n     ...}\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.as_dict()\n    {'status': 'running', 'num_ctx_switches': pctxsw(voluntary=63, involuntary=1), 'pid': 5457, ...}\n    \u003e\u003e\u003e p.is_running()\n    True\n    \u003e\u003e\u003e p.suspend()\n    \u003e\u003e\u003e p.resume()\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e p.terminate()\n    \u003e\u003e\u003e p.kill()\n    \u003e\u003e\u003e p.wait(timeout=3)\n    \u003cExitcode.EX_OK: 0\u003e\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.test()\n    USER         PID %CPU %MEM     VSZ     RSS TTY        START    TIME  COMMAND\n    root           1  0.0  0.0   24584    2240            Jun17   00:00  init\n    root           2  0.0  0.0       0       0            Jun17   00:00  kthreadd\n    ...\n    giampaolo  31475  0.0  0.0   20760    3024 /dev/pts/0 Jun19   00:00  python2.4\n    giampaolo  31721  0.0  2.2  773060  181896            00:04   10:30  chrome\n    root       31763  0.0  0.0       0       0            00:05   00:00  kworker/0:1\n    \u003e\u003e\u003e\n\nFurther process APIs\n--------------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e import psutil\n    \u003e\u003e\u003e for proc in psutil.process_iter(['pid', 'name']):\n    ...     print(proc.info)\n    ...\n    {'pid': 1, 'name': 'systemd'}\n    {'pid': 2, 'name': 'kthreadd'}\n    {'pid': 3, 'name': 'ksoftirqd/0'}\n    ...\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e psutil.pid_exists(3)\n    True\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e def on_terminate(proc):\n    ...     print(\"process {} terminated\".format(proc))\n    ...\n    \u003e\u003e\u003e # waits for multiple processes to terminate\n    \u003e\u003e\u003e gone, alive = psutil.wait_procs(procs_list, timeout=3, callback=on_terminate)\n    \u003e\u003e\u003e\n\nWindows services\n----------------\n\n.. code-block:: python\n\n    \u003e\u003e\u003e list(psutil.win_service_iter())\n    [\u003cWindowsService(name='AeLookupSvc', display_name='Application Experience') at 38850096\u003e,\n     \u003cWindowsService(name='ALG', display_name='Application Layer Gateway Service') at 38850128\u003e,\n     \u003cWindowsService(name='APNMCP', display_name='Ask Update Service') at 38850160\u003e,\n     \u003cWindowsService(name='AppIDSvc', display_name='Application Identity') at 38850192\u003e,\n     ...]\n    \u003e\u003e\u003e s = psutil.win_service_get('alg')\n    \u003e\u003e\u003e s.as_dict()\n    {'binpath': 'C:\\\\Windows\\\\System32\\\\alg.exe',\n     'description': 'Provides support for 3rd party protocol plug-ins for Internet Connection Sharing',\n     'display_name': 'Application Layer Gateway Service',\n     'name': 'alg',\n     'pid': None,\n     'start_type': 'manual',\n     'status': 'stopped',\n     'username': 'NT AUTHORITY\\\\LocalService'}\n\nProjects using psutil\n=====================\n\nHere's some I find particularly interesting:\n\n- https://github.com/google/grr\n- https://github.com/facebook/osquery/\n- https://github.com/nicolargo/glances\n- https://github.com/aristocratos/bpytop\n- https://github.com/Jahaja/psdash\n- https://github.com/ajenti/ajenti\n- https://github.com/home-assistant/home-assistant/\n\nPortings\n========\n\n- Go: https://github.com/shirou/gopsutil\n- C: https://github.com/hamon-in/cpslib\n- Rust: https://github.com/rust-psutil/rust-psutil\n- Nim: https://github.com/johnscillieri/psutil-nim\n","funding_links":["https://tidelift.com/funding/github/pypi/psutil","https://github.com/sponsors/giampaolo","https://opencollective.com/psutil","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=A9ZS7PKKRM3S8","https://tidelift.com/badges/github/giampaolo/psutil?style=flat","https://tidelift.com/subscription/pkg/pypi-psutil?utm_source=pypi-psutil\u0026utm_medium=referral\u0026utm_campaign=readme","https://opencollective.com/chenyoo-hao","https://opencollective.com/alexey-vazhnov"],"categories":["Python","DevOps Tools","资源列表","Operation System","DevOps工具","HarmonyOS","Python 程序","DevOps 工具","System","System Monitoring \u0026 Profiling","DevOps Tools [🔝](#readme)","📚 فهرست","Awesome Python","Python specific"],"sub_categories":["DevOps 工具","Monitoring","Windows Manager","网络服务_其他","Python libraries","شبکه","DevOps Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiampaolo%2Fpsutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiampaolo%2Fpsutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiampaolo%2Fpsutil/lists"}