Question

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 accurate as possible , and if possible in nanoseconds.

Thanks

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top