The io_counters is not available on OS X, 兼容处理

This commit is contained in:
cppla 2022-11-03 14:49:47 +08:00
parent 25917f0883
commit 34b1bca5b1

@ -206,6 +206,10 @@ def _disk_io():
如果这里做连续性IO那么普通机械硬盘写入到100Mb/s那么也能造成硬盘长时间的等待
磁盘读写有误差4k8k https://stackoverflow.com/questions/34413926/psutil-vs-dd-monitoring-disk-i-o
"""
if "darwin" in sys.platform:
diskIO["read"] = 0
diskIO["write"] = 0
else:
while True:
# first get a list of all processes and disk io counters
procs = [p for p in psutil.process_iter()]