0

I am using JavaSE Embedded 8 compact 2 profile on an embedded platform (like Rasp Pi). I choose compact 2 profile to have footprint as small as possible.

For development purposes, I want to do profiling, without changing the profile during runtime (as part of OS in flash memory). JavaSE Embedded 8 does include flight recorder for profiling purposes as a really cool and helpful tool. But: it requires FullJRE profile.

The page from Oracle at http://www.oracle.com/technetwork/java/embedded/resources/tech/java-flight-rec-on-java-se-emb-8-2158734.html states:

Note that JFR is available with Java SE Embedded 8 Full JRE, not with the Compact Profiles.  

Is there a technical chance to get that working on compact 2 profile? E.g. by creating a customized version of JVM which includes the addons from flight recorder? Or are there native components needed which are in FullJRE VMs only?

Update: I found meanwhile a post from Jim Connor with a statement to compact profiles. See https://blogs.oracle.com/jtc/entry/using_java_fligt_recorder_with. Jim describes in detail how to run flight recorder on compact 3 profile. As flight recorder depends on javax.management he thinks running on compact 1/2 profile does not work without substantial changes.

Kire Haglin
  • 6,569
  • 22
  • 27
  • I would say Jim is correct about compact 1/2 not working with JFR. I believe the new version of JFR will avoid depending on javax.management, but have no idea if this will make it work with the corresponding "compact 2" profile in whatever JDK is gets released with. – Klara Dec 11 '15 at 10:23

1 Answers1

0

Compact profile 2 doesn't contain JMX-functionality, and a large portion of the implementation, such as JFR diagnostic commands, is built on top of MBeans in JDK 7/8. It is therefore not possible to use Flight Recorder on compact 1/2.

JDK 9 is now released and the only module you need is jdk.jfr.

You can build a custom JDK using the jlink tool:

cd JDK9_HOME/bin/

jlink --module-path ../jmods --add-modules jdk.jfr --output ../../jfrjdk

cd ../../jfrjdk/bin
java -XX:+UnlockCommercialFeatures -XX:StartFlightRecording -version

If you want to access JFR remotely, i.e. from Java Mission Control, use the module jdk.management.jfr. Note, this will pull in JMX so the image will be larger.

Kire Haglin
  • 6,569
  • 22
  • 27
  • So no chance to package something like Jim described that for Compact profile 3. So we either have to go to Compact profile 3, wait for Java9, or do not use flight recorder. Thanks Kire for your help. – Jochen Hiller Jan 13 '16 at 07:31
  • Not really, you need compact 3 (at least) for JMX http://openjdk.java.net/jeps/161 – Kire Haglin Jan 13 '16 at 17:29
  • Are you sure that the proposed way to use FlightRecorder with compact 3 profile does really work? We tried to do that and get this error. We are using VM with enable Security Manager. ``` /usr/lib/javaSE/bin/java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder Java HotSpot(TM) Embedded Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release [jfr][WARN ][5.320] JFR initialization attempt failed. [jfr][WARN ][5.320] jdk/internal/instrumentation/Tracer Error occurred during initialization of VM Failed to start tracing backend. ``` – Jochen Hiller Feb 29 '16 at 13:38
  • Could be a bug.Try -XX:FlightRecorderOptions=loglevel=trace. Perhaps you need to set RuntimePermission jdk.internal.instrumentation.Tracer – Kire Haglin Mar 01 '16 at 09:52
  • JDK 9 has been released and you can now run on a device with low footprint. The only module you need is jdk.jfr. – Kire Haglin Sep 30 '17 at 19:41
  • Thanks Kire for helpful information. Will try that out on a RaspPi and post my results here. – Jochen Hiller Oct 02 '17 at 14:20