我想用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 apm2.8飞控罗盘bad health,加速度计校准失败
- ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
- ¥15 谁有desed数据集呀
- ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
- ¥15 关于#hadoop#的问题
- ¥15 (标签-Python|关键词-socket)
- ¥15 keil里为什么main.c定义的函数在it.c调用不了
- ¥50 切换TabTip键盘的输入法
- ¥15 可否在不同线程中调用封装数据库操作的类
- ¥15 微带串馈天线阵列每个阵元宽度计算