franco
franco

Reputation: 307

JVM PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime flags

I'm running a Java program and I need to get how much time each it spent garbage collecting. I found these 2 JVM flags: -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime

but I'm not being able to find information about it. I suppose that PrintGCApplicationStoppedTime prints for how long the application time was in a STW, however I am not sure about -XX:+PrintGCApplicationConcurrentTime. Does it print for how long the application was executing concurrently with collection threads?

Thanks in advance.

Upvotes: 14

Views: 6294

Answers (2)

Johnny
Johnny

Reputation: 15413

You using those flags to know how long your application runs between garbage collections.

Eventually that can be calculated from the GC logs but a convenient way to see that information is with the command line flags -XX:+PrintGCApplicationStoppedTime and -XX:+PrintGCApplicationConcurrentTime.

Adding these to your command line produces output such as this:

Application time: 0.2863875 seconds
Total time for which application threads were stopped: 0.0225087 seconds
Application time: 0.1476791 seconds
Total time for which application threads were stopped: 0.0255697 seconds

The application ran (reported in the first line) for about 287 milliseconds and then was stopped for about 22 milliseconds (reported in the second line).

The flags can be used separately or together.

Upvotes: 0

apangin
apangin

Reputation: 98334

The names of these flags are not very accurate.

PrintGCApplicationStoppedTime shows how much time the application was stopped at safepoint. Most often safepoints are caused by stop-the-world phases of garbage collection, however, many other reasons exist.

PrintGCApplicationConcurrentTime is how much time the application worked without stopping, i.e. the time between two successive safepoints.

Upvotes: 11

Related Questions