On Tue, Jan 6, 2009 at 8:26 AM, Kangkook Jee <aixe...@gmail.com> wrote: > I'd like to measure number of bytes sent(or recv'd) from my python > application. Does anyone have any idea how can I achieve this? > > I tried to do this by tracing some socket calls (send, sendto, sendAll) > using 'metaclass' but I could find exactly place that I can put this in. > > > My application runs some number of protocols (bittorrent, xmlrpc ..) in > it and will be measured for a couple of hours. > > Thanks a lot for your help, in advance
Something like this perhaps ? Example code follows ... NB: This uses circuits (1) $ ./test.py smtp-int.vision6.com.au 25 Trying smtp-int.vision6.com.au... Connected to smtp-int.vision6.com.au 220 marvin.vision6.com.au ESMTP EHLO localhost 250-marvin.vision6.com.au 250-AUTH LOGIN CRAM-MD5 PLAIN 250-AUTH=LOGIN CRAM-MD5 PLAIN 250-PIPELINING 250 8BITMIME QUIT 221 marvin.vision6.com.au Connection closed Traffic In: 179 bytes Out: 20 bytes --------------------------------------------------------- http://codepad.org/V32fsqKt Note the Stats component on line 60. --------------------------------------------------------- cheers James -- http://mail.python.org/mailman/listinfo/python-list