Date: Sat, 7 Jun 2008 23:29:20 +0200 From: Jeremie Le Hen <jeremie@le-hen.org> To: Mathieu Prevot <mathieu.prevot@gmail.com> Cc: hackers@freebsd.org Subject: Re: network bitrate of a poll of processes Message-ID: <20080607212920.GN13704@obiwan.tataz.chchile.org> In-Reply-To: <3e473cc60805260752o2f573cf2h12910a45cf6849e6@mail.gmail.com> References: <3e473cc60805260752o2f573cf2h12910a45cf6849e6@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Mathieu, On Mon, May 26, 2008 at 04:52:04PM +0200, Mathieu Prevot wrote: > I would like to know the bitrate of a pool of child processes that use > a network connection, how can I have something like netstat -w1 > provide but at the process level ? One way to do it is to create a dynamic library providing a wrapper for read/write/send/recv/whichever syscalls that counts the number of bytes. Use gettimeofday(2) in a construtor and destructor to print the average bitrage. At runtime, load the shared library with LD_PRELOAD. If you want real time bitrate, I think you need an external device or you may spoil the results. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080607212920.GN13704>