On Sun, 9 May 2010 12:15:49 +0530
Anand Sivaram <email@example.com
> On Sun, May 9, 2010 at 11:38, Celejar <firstname.lastname@example.org
> > Hi,
> > I'm looking for a tool that will measure bandwidth used by a specific
> > process. I'd like some sort of utility or wrapper that will answer
> > questions like "How much data did my network backup job push over the
> > wire?"
Yeah, that's pretty much what I thought. Well, I think that I'm goingArchive:
> nethogs is unique in that manner, as per their website itself.
> see section "Links" in their website
> Most of the other tools give rate per tcp/udp sessions based on port numbers
> and remote address information.
> So you may not find any other program to take care of this. I think it is
> doable with a few hundred lines of code.
> This is what is required to be done.
> * /proc/<pid>/fd look for the socket inode numbers
> * correlate those inode numbers in /proc/net/tcp and /proc/net/udp to find
> source and destination ip and port details
> * use libpcap to open the interface and capture the packet, from this you
> could get the packet length, rate etc of each tcp, udp session
> Combining the above, it is possible to get what you need.