In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Cross-platform library psutil how to understand, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.
psutil is a cross-platform library that makes it easy to get information about the processes and system utilization (including CPU, memory, disk, network, etc.) of the system running. It is mainly used for system monitoring, analysis and limitation of system resources and process management. It implements the functionality provided by equivalent command line tools such as ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap, etc.
http://psutil.readthedocs.io/en/latest/ Detailed use cases
1、CPU
1 psutil.cpu_times(percpu=False)
Return cpu usage time ancestor. If percpu=True, returns a list of CPU usage.
1 psutil.cpu_percent(interval,percpu) #Returns CPU utilization
2 psutil.cpu_times_percent(interval=None, percpu=False)
3 psutil.cpu_count(logical=True) #Return system logical CPU
4 psutil.cpu_stats() #Returns CPU statistics
5 psutil.cpu_freq(percpu=False) #Returns the CPU frequency
2. Memory
1 psutil.virtual_memory() #Returns statistics on system memory usage
2 psutil.swap_memory() #Returns system swap memory statistics
3. Disk
1 psutil.disk_partitions(all=False) #Returns a list of all mounted disk devices, including devices, mount points, and file system ancestors
2 psutil.disk_usage(path) #Returns disk statistics
3 psutil.disk_io_counters(perdisk=False, nowrap=True) #Returns disk IO statistics
4. Network
1 psutil.net_io_counters(pernic=False) #Returns system network IO statistics
2 psutil.net_connections(kind ='inet ') #return system socket connections
3 psutil.net_if_addrs() #Returns the IP, subnet mask and broadcast address bound to the NIC
4 psutil.net_if_stats() #Returns information about the NIC
5. Sensors
1 psutil.sensors_temperatures(Fahrenheit=False) #Returns the temperature of hardware
2 psutil.sensors_fans() #Returns hardware fan speed
3 psutil.sensors_battery() #Returns battery status
6. Other
1 psutil.boot_time() #System boot time
2 psutil.users() #List of users connected to the system
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.