CodePudding user response:
Under the most good-looking psutil module's source code, analyze what are the methods, the commonly used method, as follows, to get some calculation, combine the line:[CPU information]
1,
psutil. Cpu_times () # CPU full information
2,
psutil. Cpu_times (). The user # user CPU information
. 3,
psutil cpu_times (). Iowait # IO wait time
. 4,
psutil cpu_count (#) logical CPU number
5,
psutil. Cpu_count (logical=False) # number of physical CPU
6,
psutil. Cpu_percent () # CPU utilization
.
[memory] information
1,
psutil. Virtual_memory () # memory complete information
2,
psutil. Virtual_memory (). The total # all memory
.
[disk information]
1,
psutil. Disk_partitions () # partition usage
2,
psutil. Disk_usage ('/') # disk utilization
3,
psutil. Disk_io_counters (perdisk=True) # disk IO number and read and write information
.
[network information]
# 1,
psutil.net _io_counters () to obtain network general IO situation
2,
psutil.net _io_counters (pernic=True) # access card IO of
.
Detailed reference website: http://pythonhosted.org/psutil/
CodePudding user response:
These I know, just want to know how to calculate the CPU loadCodePudding user response: