我想用Python抓到网络的使用率netUsage,计算公式为:
netUsage = Bytes Total / Current Bandwidth,
现在可以用 psutil.net_io_counters()分别求得收发的速率,进而求得Bytes Total,
1.但是current bandwidth怎么求呢?
2.网上找到了一种方法是使用psutil.net_if_stats().items()中的speed参数来求,详见
https://bbs.csdn.net/topics/392055372?list=lz
但是这里的speed是什么速率呢?找了半天也没找到合适的答案
3.一块网卡,用psutil.net_io_counters(pernic=true)返回来一个字典类型有三个值,解释如下,但是没看明白什么是every network interface installed on the system(系统实际安装的网口?)求网络大神指点
If pernic is True return the same information for every
network interface installed on the system as a dictionary
with network interface names as the keys and the namedtuple
described above as the values.
python怎么获取网卡的理论带宽?net_if_stats()中的speed指的是什么速率?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- threenewbee 2018-11-20 14:43关注
netUsage = Bytes Total / Current Bandwidth,
一般带宽都是小b(位每秒),所以应该结果也是小b。every network interface installed on the system
如果你的每个网卡都只有一个网口,你可以简单将网口理解为网卡。解决 无用评论 打赏 举报
悬赏问题
- ¥15 程序不包含适用于入口点的静态Main方法
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记