Take the 2-minute tour ×

I want to print the total number of NATIVE TARGET instructions executed while executing a program using the JIT.

My plan was to add a instruction (which increment a variable in memory) after EVERY instruction of the just in time compiled assembly. For this, i need access to the section containing the 'just in time' compiled assembly instructions. The JIT documentation for LLVM is not good, and i was not able to reverse engineer the JIT specific code in LLVM!

Could you please give me some hints on this ? Thanks !

share|improve this question
Do you want to count any instruction (with code from LLVM JIT), or only instructions, generated by JIT? There are some hardware counters for instructions executed. If you really want to instrument code, there can be some optimizations (don't add +1 after every instr, but +n after every basic block of instrs). –  osgx May 30 '12 at 17:32
There is some instrumentation support which is used for profiling, gcov, asan; but don't know will this approach work with JIT. –  osgx May 30 '12 at 17:37
Hi, I want the count of only the Instructions generated by JIT. Thanks for the advice :) –  Anay May 30 '12 at 19:46
add comment

Your Answer



Browse other questions tagged or ask your own question.