Formatting garbage collection output with timestamps

If you are running a version of java where -XX:+PrintGCDateStamps is not honored, you can run what is below.

For those that are unaware, by default garbage collection will print the seconds since the JVM process started. In the heat of battle, this is almost useless unless you are the guy from “A Beautiful Mind”.

What is below will read the entire file and convert the seconds to a timestamp.


Output will be similar to what is below...

Thu 09 May 2013 01:20:51 PM EDT [GC 1321092.626: [ParNew: 671948K->45789K(707840K), 0.1335720 secs] 4130848K->3510152K(6212864K), 0.1422530 secs] [Times: user=0.40 sys=0.00, real=0.14 secs]
Thu 09 May 2013 01:21:18 PM EDT [GC 1321119.062: [ParNew: 675037K->45370K(707840K), 0.1424780 secs] 4139400K->3515895K(6212864K), 0.1507360 secs]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.