mixing jmh and native jni calls
Jens Wilke
jw_list at headissue.com
Mon May 23 07:55:12 UTC 2016
On Sunday 22 May 2016 09:45:42 Ymo Lists wrote:
> Hi All.
>
> I am trying to mix jmh and calling jni from a .so file in linux. When i run
> this outside of jmh i am able to make the calls from my simplified app. I
> understand that jmh forks a new jvm but how do i debug the forked jvm so
> that i can see why this .so library is not getting loaded ?
You can disable forking with "-f 0" and debug directly in a single JVM.
Second, check the command line arguments. maybe you need to set the library path?
By default JMH takes over the arguments of the parent JVM. Maybe you set different
arguments for benchmarking? Check the first lines of output:
# JMH 1.11.3 (released 126 days ago, please consider updating!)
# VM version: JDK 1.8.0_74, VM 25.74-b02
# VM invoker: /opt/headissue/amd64/jdk1.8.0_74/jre/bin/java
# VM options: -server -Xmx2G -XX:+UseG1GC -XX:+UseBiasedLocking
. . .
If you want to know whether the JVM is looking for your library at all and where, you can
use strace. E.g.
strace -f java ..... 2> bigfilewithalloscalls.txt
And grep in the bigfile for your library name.
Cheers,
Jens
--
"Everything superfluous is wrong!"
// Jens Wilke - headissue GmbH - Germany
\// https://headissue.com
More information about the jmh-dev
mailing list