我使用以下配置运行java应用程序
-Xmx512M
-Xms32M
-XX:+PrintGCApplicationStoppedTime
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-Xloggc:Desktop/Gen/Gen/gc.log
-XX:+PrintGCTimeStamps
-XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGC
但它不是在gc.log文件中打印GCTimeStamps ..
gc.log文件内容如下所示..
Application time: 0.0272860 seconds
2015-01-23T17:18:14.054+0100: 0.731: [GC [PSYoungGen: 94627K->58213K(108928K)] 226219K->217525K(287744K), 0.0607860 secs] [Times: user=0.35 sys=0.12, real=0.06 secs]
2015-01-23T17:18:14.115+0100: 0.792: [Full GC [PSYoungGen: 58213K->38649K(108928K)] [PSOldGen: 159312K->178815K(251904K)] 217525K->217465K(360832K) [PSPermGen: 4237K->4237K(21248K)], 0.1840190 secs] [Times: user=0.18 sys=0.01, real=0.19 secs]
Total time for which application threads were stopped: 0.2449170 seconds
Application time: 0.0107920 seconds
答案 0 :(得分:1)
从您的日志中
Application time: 0.0272860 seconds
以上行由-XX:+PrintGCApplicationConcurrentTime
生成,没有日期戳
2015-01-23T17:18:14.054+0100: 0.731: [GC [PSYoungGen: 94627K->58213K(108928K)] 226219K->217525K(287744K), 0.0607860 secs] [Times: user=0.35 sys=0.12, real=0.06 secs]
2015-01-23T17:18:14.115+0100: 0.792: [Full GC [PSYoungGen: 58213K->38649K(108928K)] [PSOldGen: 159312K->178815K(251904K)] 217525K->217465K(360832K) [PSPermGen: 4237K->4237K(21248K)], 0.1840190 secs] [Times: user=0.18 sys=0.01, real=0.19 secs]
以上行由-XX:+PrintGCDetails
生成,日期戳是
Total time for which application threads were stopped: 0.2449170 seconds
以上行由-XX:+PrintGCApplicationStopedTime
生成,没有日期戳
Application time: 0.0107920 seconds
以上行由-XX:+PrintGCApplicationConcurrentTime
生成,没有日期戳
总结
-XX:+PrintGCDateStamps
仅适用于-XX:+PrintGCDetails
输出-XX:+PrintGCApplicationConcurrentTime
和-XX:+PrintGCApplicationStoppedTime
不能以日期戳为前缀
您可以找到有关GC诊断选项的更多详细信息here。