Question about monitoring Java JIT (from java bytecode to x86 code)

Hello

Question about monitoring Java JIT (from java bytecode to x86 code)
from JRuby.

I am trying to monitor java JIT, but in vain.
The command line is configured as follows (using test/test_class.rb in
jruby distribution)

jruby -J-XX:+PrintCompilation -J-XX:CompileThreshold=1
-J-XX:-Xjit.logging=true -Xjit.threshold=1 test\test_class.rb

I can monitor JRuby JIT(from ruby to java bytecode) can monitor by using
-J-verbose:class
test$test_class$method__2$RUBY$inherited
But I cannnot monitor java JIT with -J-XX:+PrintCompilation even using
other command like -J-XX:+LogCompilation.

Is there missing point in above procedure or I need to hack Java VM code
to monitor java JIT?

Currently I am using follows on Windows 7 on 64-bit
JDK1.6.0_29
JRuby 1.6.7

I referred following documents.

Thanks
Atsushi SAKAI

On Fri, Mar 9, 2012 at 6:00 AM, Atsushi SAKAI [email protected]
wrote:

Hello

Question about monitoring Java JIT (from java bytecode to x86 code) from JRuby.

I am trying to monitor java JIT, but in vain.
The command line is configured as follows (using test/test_class.rb in jruby
distribution)

jruby -J-XX:+PrintCompilation -J-XX:CompileThreshold=1 -J-XX:-Xjit.logging=true
-Xjit.threshold=1 test\test_class.rb

The -J-XX:+PrintCompilation flag should work fine to show the JVM
eventually compiling Java code (and jitted JRuby code) to native. It
will list the methods as they’re compiled (and as they’re thrown out,
if they need to re-optimize). Keep in mind that when running the
server VM, methods must be called 10k times to JIT to native. That
brings us to your next flag…

-J-XX:CompileThreshold=1 should force the JVM to compile things right
away, but I would recommend just running your code longer to get a
better idea of how it optimizes.

Your next flag doesn’t seem correct. If you’re trying to pass this to
JRuby, it would jube be -Xjit.logging=true. The threshold flag is
fine; JRuby does not optimize based on runtime profiles, so you can
feel free to force compilation with the threshold flag or by having
JRuby compile every file on load with -X+C.

With these flags, you do not get any output from the JVM about
compiling code? Here’s what I get for a simple benchmark:

I referred following documents.
http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html

Also see the flags in my JVM JIT for Dummies talk here:

  • Charlie

Thank you for your suggestion.
Also your citation is helpful.

It works fine (on Windows7 64bit), but I still have a problem.

Following your suggested CLI works fine.

jruby -J-XX:+PrintCompilation -X+C bench\bench_fib_recursive.rb |

grep.exe $RUBY

Also following CLI works fine.(with adding -J-Xcomp)

jruby -J-XX:+PrintCompilation -X+C -J-Xcomp test\test_class.rb |

grep.exe $RUBY

But the -J-XX:CompileThreshold=(1 or some value) does not effectively
work at this moment.
Any missing parameter exists on JDK?

Thanks
Atsushi SAKAI

On Sat, 10 Mar 2012 13:11:22 -0600
Charles Oliver N. [email protected] wrote:

The -J-XX:+PrintCompilation flag should work fine to show the JVM
Your next flag doesn’t seem correct. If you’re trying to pass this to

http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html


Atsushi SAKAI [email protected]