-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpysys.py
64 lines (49 loc) · 1.52 KB
/
pysys.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import os
import platform
import psutil
import numpy as np
import cpuinfo
class CPU:
# CPU Core Count
def cpuCoreCount():
return os.cpu_count()
# Processor/CPU Type
def processorType():
return platform.processor()
# Computer Architecture
def computerArchitecture():
return platform.architecture()
# Physcial CPU Cores
def phyicalCoresCPU():
return psutil.cpu_count(True)
# Logical CPU Cores
def logicalCoresCPU():
return psutil.cpu_count(False)
# Overall CPU Usage
def CPUsage():
return psutil.cpu_percent()
# CPU Info
def CPU():
return cpuinfo.get_cpu_info()["brand_raw"]
class OSType:
def OS():
return platform.system()
class RAM:
# Overall RAM Usage
def RAMUsage():
ram = np.round(psutil.virtual_memory().used/1000000000, 1)
totalRAM = np.round(psutil.virtual_memory().total/1000000000, 2)
swap = np.round(psutil.swap_memory().used/1000000000, 1)
return ram, totalRAM, swap
def swapMemory():
return np.round(psutil.swap_memory().used/1000000000, 1)
def totalRAM():
return np.round(psutil.virtual_memory().total/1000000000, 2)
def usedRAM():
return np.round(psutil.virtual_memory().used/1000000000, 1)
class Memory:
def storageUsage(file = "/"):
storage = psutil.disk_usage(file)
return storage
def partitions():
return psutil.disk_partitions(True)