get_cpu_usage(interval=1)

This commit is contained in:
2023-10-22 20:47:05 +08:00
parent 6ad0d78286
commit d5209ea7bc
2 changed files with 9 additions and 0 deletions

View File

@@ -3694,6 +3694,12 @@ def encryption_SHA_256(password, salt=''):
hashed_password = hashlib.sha256(password.encode()).hexdigest()
return hashed_password
# 获取CPU使用率
def get_cpu_usage(interval=1):
import psutil
cpu_usage = psutil.cpu_percent(interval=interval)
return cpu_usage
# 获取当前日期字符串
def get_date(bar=True):
import datetime