networking: add traffic statistics to NetworkDevice - #958
Conversation
|
What do the traffic statistics actually mean in absence of a refresh period? Seems like deriving any useful metric about speed would be hard unless theres an expected way to do that. When we do have a time frame, do you think normalizing it to bytes/sec seems like a good idea? |
Yeah.. this is a bad API from NM. I didn't consider that you can't count the # of refreshes and calculate speed from that. There's no update signal to count if no bytes are rx/txed.
Yes that'd be better. I could add an internal timer however you can't easily ensure it's synced with NMs. Polling /sys is easy, more accurate, and needed for other backends to support speed anyway. |
|
Rather than keeping a separate timer you could just use rate to multiply bytes if nonzero, and probably just 0 out tx/rx if rate is 0 |
Adds these properties to
NetworkDevice:rxBytes: Number of received bytestxBytes: Number of transmitted bytesrefreshRate: How often to refreshrxBytesandtxBytesin millisecondsUseful for upload/download speed