Some stuff I did to get oprofile working with JRuby:
- Build my own oprofile according to instructions here: http://fiji.sc/Profiling_Java_Code#OProfile
- Enable profiling, naturally
- Run JRuby as
jruby -J-agentpath:path/to/libjvmti_oprofile.so ...
- Run commands as seen in this blog post to create annotated output, etc: https://github.com/ryoqun/rubinius/blob/4e560bf8bdc56769317aa0cc438bf5094c736d52/web/_posts/2013-03-20-profiling-jitted-ruby-code-with-oprofile.markdown
Everything worked pretty much as I expected. You might want to pass -X+C to JRuby to make sure things compile to bytecode right away (so JVM can JIT them sooner).