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
  • 857
  • 9
  • 31

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
  • 92,924
  • 10
  • 193
  • 247