Psutil a python-based cross-platform system Information tracking module

Source: Internet
Author: User

Benefit from the help of this module, where I recommend one hand.

https://pythonhosted.org/psutil/#processes

Psutil is a python-based, cross-platform System Information monitoring module. Under Python, we can use it to monitor, detect, and limit the use of system resources. It provides a command function similar to a set of consoles, such as ps.netstat.ifconfig and so on. The system currently supported by this module has Windows/osx/linux/freebsd/sun Solaris. 32, 64-bit support. The Python environment is 2.6-3.5.

Here I show you how to locate a target process:

in [+]: for proc in Psutil.process_iter ():   ....:     try: ....   :         if Proc.name () and ' Target process ' in Proc. Name ():  # Here I'm going to make sure that name is not none because the process may suddenly close ....   :             print (proc.pid) ...   .:     except Psutil. Nosuchprocess: ....   :         Pass

Psutil a python-based cross-platform system Information tracking module

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.