0

We can determine the compile threshold using these jvm flags -XX:+PrintFlagsFinal -XX:+PrintFlagsInitial, but is there a way of determining it programmatically at runtime?

Dev2017
  • 837
  • 7
  • 29

1 Answers1

2

Yes, you can get the value, though it is absolutely useless.
With Tiered Compilation (defaut), this flag is meaningless.

Here is how to get a value of any HotSpot VM flag:

HotSpotDiagnosticMXBean mbean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
String value = mbean.getVMOption("CompileThreshold").getValue();
apangin
  • 86,266
  • 9
  • 178
  • 218