File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ def get_swap():
4646 return int (Mem .total / 1024.0 ), int (Mem .used / 1024.0 )
4747
4848def get_hdd ():
49- # todo, 兼容macos ,beta
5049 if "darwin" in sys .platform :
5150 return int (psutil .disk_usage ("/" ).total / 1024.0 / 1024.0 ), int ((psutil .disk_usage ("/" ).total - psutil .disk_usage ("/" ).free )/ 1024.0 / 1024.0 )
5251 else :
@@ -108,9 +107,8 @@ def tupd():
108107 t = int (os .popen ('netstat -an|find "TCP" /c' ).read ()[:- 1 ])- 1
109108 u = int (os .popen ('netstat -an|find "UDP" /c' ).read ()[:- 1 ])- 1
110109 p = len (psutil .pids ())
111- d = 0
112- # cpu is high, default: 0
113- # d = sum([psutil.Process(k).num_threads() for k in psutil.pids()])
110+ # if you find cpu is high, please set d=0
111+ d = sum ([psutil .Process (k ).num_threads () for k in psutil .pids ()])
114112 else :
115113 t ,u ,p ,d = 0 ,0 ,0 ,0
116114 return t ,u ,p ,d
@@ -221,7 +219,7 @@ def _disk_io():
221219 比如我这里是机械硬盘,大量做随机小文件读写,那么很低的读写也就能造成硬盘长时间的等待。
222220 如果这里做连续性IO,那么普通机械硬盘写入到100Mb/s,那么也能造成硬盘长时间的等待。
223221 磁盘读写有误差:4k,8k ,https://stackoverflow.com/questions/34413926/psutil-vs-dd-monitoring-disk-i-o
224- macos,暂不处理。
222+ macos/win ,暂不处理。
225223 """
226224 if "darwin" in sys .platform or "win" in sys .platform :
227225 diskIO ["read" ] = 0
You can’t perform that action at this time.
0 commit comments