Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from cppla:master #14

Merged
merged 4 commits into from
Nov 30, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
get macos infomation build
  • Loading branch information
cppla committed Nov 30, 2022
commit 806b60bd6ba1e838da59e01eccaeb01bc3f11c2c
8 changes: 3 additions & 5 deletions clients/client-psutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def get_swap():
return int(Mem.total/1024.0), int(Mem.used/1024.0)

def get_hdd():
# todo, 兼容macos ,beta
if "darwin" in sys.platform:
return int(psutil.disk_usage("/").total/1024.0/1024.0), int((psutil.disk_usage("/").total-psutil.disk_usage("/").free)/1024.0/1024.0)
else:
Expand Down Expand Up @@ -108,9 +107,8 @@ def tupd():
t = int(os.popen('netstat -an|find "TCP" /c').read()[:-1])-1
u = int(os.popen('netstat -an|find "UDP" /c').read()[:-1])-1
p = len(psutil.pids())
d = 0
# cpu is high, default: 0
# d = sum([psutil.Process(k).num_threads() for k in psutil.pids()])
# if you find cpu is high, please set d=0
d = sum([psutil.Process(k).num_threads() for k in psutil.pids()])
else:
t,u,p,d = 0,0,0,0
return t,u,p,d
Expand Down Expand Up @@ -221,7 +219,7 @@ def _disk_io():
比如我这里是机械硬盘,大量做随机小文件读写,那么很低的读写也就能造成硬盘长时间的等待。
如果这里做连续性IO,那么普通机械硬盘写入到100Mb/s,那么也能造成硬盘长时间的等待。
磁盘读写有误差:4k,8k ,https://stackoverflow.com/questions/34413926/psutil-vs-dd-monitoring-disk-i-o
macos,暂不处理。
macos/win,暂不处理。
"""
if "darwin" in sys.platform or "win" in sys.platform:
diskIO["read"] = 0
Expand Down