1 Reply Latest reply: Dec 16, 2008 10:19 PM by 843810 RSS

    Help on using JVMTI to count exectuded bytecode


      I know this might be a broad question, but I am looking at JVMTI as a possible method to count the number of executed Java bytecode operations and was wondering if this was possible? To be more specific, is there a way to count only the executed bytecodes from a specific code region, say the number bytecodes within a certain loop iteration, for example. I am not looking for a full solution, but maybe rather someone to point me in the right direction.

      Any help would be greatly appreciated. Thank you.

      David Zier
        • 1. Re: Help on using JVMTI to count exectuded bytecode
          Yes it is possible to do using JVMTI and it is also possible using jdi.


          Basically you need to implement the stepi feature of a debugger. I would suggest you to take a look
          at the jdb source code. Which is available for free at openjdk.java.net. Download the jdk source code
          and the jdb source is in src/share/classes/com/sun/tools/examples/tty directory.