bellawer 2018-11-20 12:38 采纳率: 0%
浏览 2264

python怎么获取网卡的理论带宽?net_if_stats()中的speed指的是什么速率?

我想用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.

  • 写回答

1条回答

  • threenewbee 2018-11-20 14:43
    关注

    netUsage = Bytes Total / Current Bandwidth,
    一般带宽都是小b(位每秒),所以应该结果也是小b。

    every network interface installed on the system
    如果你的每个网卡都只有一个网口,你可以简单将网口理解为网卡。

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型