最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - PSUTIL net_io_counter function returns unexpected results - Stack Overflow

programmeradmin4浏览0评论

net_io_counters() from ps_utils returns different results for bytes sent and recv than other methods like netsh wlan show inter when launching high throughput traffic.

Here is a way to replicate the problem:

def get_sent_bytes():
    bytes_Sent = psutil_io_counters(pernic=True)["your_interface"].bytes_sent
def get_recv_bytes():
    //same as upper func but with .bytes_recv
Now on 2 separte device A and B :
A : iperf3 -s
B : iperf3 -c [ip of the A's interface you want to test] 
Now on A and B :  every second returns the result of get_sent_bytes and get_recv_bytes.
As you start launching more iperfs, you will start noticing a divergence between sent_bytes values and recv_bytes values using psutils rather than netsh wlan show intf or other commands.

I saw a thread saying that psutils returns multicast, unicast and broadcast and that may be why the value differs from other method of getting rx and tx but Im not sure.

发布评论

评论列表(0)

  1. 暂无评论