get_cpu_usage(interval=1)
This commit is contained in:
		| @@ -851,6 +851,9 @@ hashed_password = guan.encryption_MD5(password, salt='') | |||||||
| # 使用SHA-256进行散列加密 | # 使用SHA-256进行散列加密 | ||||||
| hashed_password = guan.encryption_SHA_256(password, salt='') | hashed_password = guan.encryption_SHA_256(password, salt='') | ||||||
|  |  | ||||||
|  | # 获取CPU使用率 | ||||||
|  | cpu_usage = guan.get_cpu_usage(interval=1) | ||||||
|  |  | ||||||
| # 获取当前日期字符串 | # 获取当前日期字符串 | ||||||
| datetime_date = guan.get_date(bar=True) | datetime_date = guan.get_date(bar=True) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3694,6 +3694,12 @@ def encryption_SHA_256(password, salt=''): | |||||||
|     hashed_password = hashlib.sha256(password.encode()).hexdigest() |     hashed_password = hashlib.sha256(password.encode()).hexdigest() | ||||||
|     return hashed_password |     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): | def get_date(bar=True): | ||||||
|     import datetime |     import datetime | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user