Update fun.py
Browse files
fun.py
CHANGED
@@ -21,11 +21,10 @@ PORT_RANGE = (9300, 9700)
|
|
21 |
CHROME_PATH = "google-chrome" # Linux下可用命令,或自定义绝对路径
|
22 |
PROFILE_BASE = "/tmp/profiles"
|
23 |
def get_system_usage():
|
24 |
-
cpu = subprocess.check_output("top -
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
return f'CPU: {cpu.decode().strip()}\nMemory: {member.decode().strip()}'
|
29 |
def get_free_port():
|
30 |
used_ports = {b["port"] for b in BROWSERS.values()}
|
31 |
for _ in range(100):
|
|
|
21 |
CHROME_PATH = "google-chrome" # Linux下可用命令,或自定义绝对路径
|
22 |
PROFILE_BASE = "/tmp/profiles"
|
23 |
def get_system_usage():
|
24 |
+
cpu = subprocess.check_output("top -bn1 | grep 'Cpu(s)'", shell=True).decode().strip()
|
25 |
+
mem = subprocess.check_output("free -m | grep Mem", shell=True).decode().strip()
|
26 |
+
print("系统资源 cpu:", cpu, "内存:", mem)
|
27 |
+
return f'CPU: {cpu}\nMemory: {mem}'
|
|
|
28 |
def get_free_port():
|
29 |
used_ports = {b["port"] for b in BROWSERS.values()}
|
30 |
for _ in range(100):
|