Skip to content

[Windows] psutil.net_io_counters I/O is limited to 32bit unsigned integer because of MIB_IFROW #816

Closed
@jomann09

Description

Interesting problem I have seen for a while with using psutil. I'm by no means an expert with this but it is strange that when I approach 4 billion bytes it seems to rollover... I thought Python accounted for 32-bit integers and whatnot. Can someone explain if this can be accounted for?

What I'm using:
Python 2.7.11 (tried both 32 and 64 bit)
Windows 10 64 bit
psutil 4.1.0

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> import psutil
>>> psutil.net_io_counters(pernic=True)
>>> {'Ethernet 4': snetio(bytes_sent=378813079, bytes_recv=838898995, packets_sent=4236049, packets_recv=20927779, errin=0, errout=0, dropin=212, dropout=0)}

Is this a product of Windows? Are the counters only a certain size? Because in my windows ethernet status screen under 'Activity' it shows:

Bytes sent: 337,887,481
Byes recieved: 30,797,026,512

While the bytes_sent is off it doesn't surprise me that there may be small differences but the bytes_recv about a hour ago showed a value of around 3,400,000,000 bytes and now it is only showing in the 800 millions.

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions