Kernel: Record network statistics and expose as JSON

This is comprised of five small changes:

* Keep a counter for tx/rx packets/bytes per TCP socket
* Keep a counter for tx/rx packets/bytes per network adapter
* Expose that data in /proc/net_tcp and /proc/netadapters
* Convert /proc/netadapters to JSON
* Fix up ifconfig to read the JSON from netadapters
This commit is contained in:
Conrad Pankoff 2019-08-08 12:32:35 +10:00 committed by Andreas Kling
parent 061c092fae
commit 7ed54d86d5
Notes: sideshowbarker 2024-07-19 12:49:37 +09:00
7 changed files with 88 additions and 20 deletions

View file

@ -334,6 +334,8 @@ void handle_tcp(const EthernetFrameHeader& eth, int frame_size)
return;
}
socket->record_incoming_data(ipv4_packet.payload_size());
#ifdef TCP_DEBUG
kprintf("handle_tcp: state=%s\n", TCPSocket::to_string(socket->state()));
#endif