Dev2017
Dev2017

Reputation: 938

Is there a way of determining JVM CompileThreshold programmatically in java?

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?

Upvotes: 0

Views: 458

Answers (1)

apangin
apangin

Reputation: 98630

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();

Upvotes: 3

Related Questions