From mboxrd@z Thu Jan 1 00:00:00 1970 From: amosbird@gmail.com (Amos Bird) Date: Sat, 14 Jul 2018 11:24:23 +0800 Subject: Trying to export per process network bandwidth stats under /proc/[pid]/ Message-ID: <87in5iwlco.fsf@gmail.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Hello! I'm trying to add a proc entry under /proc/[pid] in order to get per process network bandwidth stats. I suppose it's similar to /proc/[pid]/io . However I couldn't find a modular way to add entries under /proc/[pid]. This thread https://lists.kernelnewbies.org/pipermail/kernelnewbies/2011-January/000475.html suggests modifying the kernel which isn't practical to me. Here is what I've found by going through a bit of the related kernel code. 1. I need to find a way to override or hooking `sock_sendmsg`/`sock_recvmsg` functions with accounting variables like `task_io_accounting` 2. a way to add proc entries under /proc/[pid] with readops printing `current` netio accounting variables. Am I on the right path of implementing this? Thanks! -- Amos Bird amosbird at gmail.com