开发者

measuring a java program runtime using asm Instrumantation

开发者 https://www.devze.com 2023-01-29 17:54 出处:网络
I was wondering if there is a way to measure a given bytecode (class file , that has main function in the original code) runtime using java bytecode instrumentation of asm.

I was wondering if there is a way to measure a given bytecode (class file , that has main function in the original code) runtime using java bytecode instrumentation of asm.

The measure should be as ac开发者_Go百科curate as possible , and if possible in nanoseconds.

Thanks


Be warned that adding System.nanoTime() or the like will add 300 nano-seconds or more to the section of code measured.

It is possible in ASM, but I suspect won't give you the results you want.

Have you tried doing a performance test of the method. i.e. calling it for 2 seconds to see what the average call time was. This can be accurate/stable to a nano-second if you call it long enough.

0

精彩评论

暂无评论...
验证码 换一张
取 消