gpt4 book ai didi

python - 如何找到网络接口(interface)传输性能?

转载 作者:太空宇宙 更新时间:2023-11-04 11:52:28 24 4
gpt4 key购买 nike

我正在使用 python 代码检查接口(interface)发送的字节数。

>>> test = psutil.net_io_counters(pernic=True)
>>> test['en1'].bytes_sent

但是,我有一个简单的问题,比如当计数器溢出时会发生什么——比如接口(interface)可以告诉的最大限制是多少。我看到接口(interface)计数器不断增加。这些计数器的限制是什么?我什么时候会看到计数器溢出或翻转?我在哪里可以看到这些限制?我正在使用 Ubuntu 机器或 mac OSX 来运行这个程序?

我重新运行了这个程序,我看到发送的字节数一直在增加,但我不知道它什么时候翻转。

最佳答案

在 Linux 上,the underlying tx_bytes/rx_bytes counters显然是无符号的 64 位计数器,因此它们的范围从 0 到很高的 18,446,744,073,709,551,615 字节(或大约 18,446,744 TB)。

我认为您不必担心溢出。

关于python - 如何找到网络接口(interface)传输性能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55627801/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com