python - PSUTIL net_io_counter function returns unexpected results - Stack Overflow

net_io_counters() from ps_utils returns different results for bytes sent and recv than other methods li

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744815756a4595314.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信