-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16.psutils.py
More file actions
38 lines (26 loc) · 1.51 KB
/
16.psutils.py
File metadata and controls
38 lines (26 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# pip install psutil
import psutil
print(psutil.cpu_count()) #16
print(psutil.cpu_count(logical=False)) #8
print(psutil.cpu_times())
#scputimes(user=4131.390625, system=2310.671875, idle=301578.90625, interrupt=167.25, dpc=223.609375)
for x in range(10):
print(psutil.cpu_percent(interval=1, percpu=True))
# [7.9, 6.3, 13.8, 15.4, 6.3, 6.3, 7.9, 12.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 13.8, 18.8, 0.0, 0.0, 1.5, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 13.6, 10.9, 0.0, 0.0, 0.0, 1.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 13.6, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 15.4, 12.3, 0.0, 0.0, 14.1, 15.6, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 12.1, 7.7, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 12.3, 10.9, 0.0, 0.0, 1.6, 3.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 25.4, 17.2, 0.0, 0.0, 3.1, 6.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 17.6, 12.3, 0.0, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
# [0.0, 0.0, 9.1, 7.7, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
print(psutil.virtual_memory())
#svmem(total=68653871104, available=60798660608, percent=11.4, used=7855210496, free=60798660608)
print(psutil.swap_memory())
# sswap(total=10737418240, used=2295304192, free=8442114048, percent=21.4, sin=0, sout=0)
print(psutil.disk_partitions())
print(psutil.net_io_counters())
print(psutil.net_if_stats())
print(psutil.net_connections())