Description
I recently had to parse some GC logs produced with JDK 1.7.0_12-ea-b08. Upon loading the file in GCViewer, a bunch of NumberFormatException
s were reported. I tracked this down to the fact that the following format is currently not supported:
[Eden: 118.0M(118.0M)->0.0B(112.0M) Survivors: 10.0M->16.0M Heap: 548.6M(640.0M)->440.6M(640.0M)]
After some debugging, I noticed that DataReaderSun1_6_0G1#parseDetails
calls AbstractDataReaderSun#setMemoryExtended
which attempts to parse the values as integers using NumberParser#parseInt
. Clearly that fails due to the presence of decimal separators. Also, in AbstractDataReaderSun#setMemoryExtended
the for
-loop that determines the length of the post-memory number (line 140) assumes that all characters are digits (so not a dot).
It'd be great if GCViewer would support this!
(Locally I added an ugly hack to NumberParser#parseInt
in order work around these things (that was faster than generating a new GC log ;)), but these changes are not suitable for sharing. (If you really want me to I can paste them here, though...).)
Semi-relatedly, I noticed that only one of the six methods in NumberParser
is used. It might be worthwhile to determine how much of a speedup the NumberParser
provides over Java's built-in API. If the difference is not very significant, I'd drop that class entirely and simply fix this issue with some calls to String#substring
and Double#parseDouble
instead. (And a small change to AbstractDataReaderSun#getMemoryInKiloByte
.) If you agree with that approach I'd be willing to make the changes and open a pull request.