sockets - Java: measure network bandwidth for a specific code segment -


i want add bandwidth measurements servers (written in pure java). thinking of api like

measurebandwidthsignletone.getinstance().startmeasuring(); ...... .....//here may connect db or using http (httpurlconnection)... ..... measurebandwidthsignletone.getinstance().endmeasuring(); 

problem have many different kinds of code access network (jdbc, httpurlconnection, ftp, etc...) wondering if can somehow attach threadlocal monitor sockets, allow me know how many bytes uploaded or download.

i know 1 way using asm / aspectj change byte code - there simpler way plug in java socket api?

thank you

what setting custom made socketfactoryimpl? can work?

that work specific version of jvm. if know version targeting create modified version of class.

the reason won't work generic jvm class uses internal apis can different between versions why byte code injection more work broad range of jvms.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -