1717import com .tagtraum .perf .gcviewer .util .ParsePosition ;
1818
1919/**
20+ * <p>The AbstractDataReaderSun is the base class of most Sun / Oracle parser implementations.
21+ * It contains a lot of helper methods to do the actual parsing of the details of a gc event.
22+ * New parsers for Sun / Oracle gc algorithms should derive from this class.</p>
2023 *
21- * Date: Feb 12, 2002
22- * Time: 4:30:27 PM
24+ * <p> Date: Feb 12, 2002</p>
25+ * <p> Time: 4:30:27 PM</p>
2326 * @author <a href="mailto:[email protected] ">Hendrik Schreiber</a> 24- * @version $Id: $
27+ * @author <a href="mailto:[email protected] ">Joerg Wuethrich</a> 2528 */
2629public abstract class AbstractDataReaderSun implements DataReader {
2730
@@ -38,7 +41,9 @@ public abstract class AbstractDataReaderSun implements DataReader {
3841 private static Logger LOG = Logger .getLogger (AbstractDataReaderSun .class .getName ());
3942 private static SimpleDateFormat dateParser = new SimpleDateFormat (DATE_STAMP_FORMAT );
4043
44+ /** the reader accessing the log file */
4145 protected BufferedReader in ;
46+ /** the log type allowing for small differences between different versions of the gc logs */
4247 protected GcLogType gcLogType ;
4348
4449 /**
@@ -53,10 +58,6 @@ public AbstractDataReaderSun(InputStream in, GcLogType gcLogType) throws Unsuppo
5358 this .gcLogType = gcLogType ;
5459 }
5560
56- protected void setMemoryAndPauses (GCEvent event , String line ) throws ParseException {
57- setMemoryAndPauses (event , line , new ParsePosition (0 ));
58- }
59-
6061 /**
6162 * Returns the amount of memory in kilobyte. Depending on <code>memUnit</code>, input is
6263 * converted to kilobyte.
@@ -86,6 +87,26 @@ else if ('G' == memUnit) {
8687 }
8788 }
8889
90+ /**
91+ * Convenience method to parse memory information followed by a pause time.
92+ *
93+ * @param event event where the result should be written to
94+ * @param line line to be parsed (from the beginning)
95+ * @throws ParseException is thrown to report any problems the parser runs into
96+ * @see #setMemoryAndPauses(GCEvent, String, ParsePosition)
97+ */
98+ protected void setMemoryAndPauses (GCEvent event , String line ) throws ParseException {
99+ setMemoryAndPauses (event , line , new ParsePosition (0 ));
100+ }
101+
102+ /**
103+ * Parses memory information in the format <number>KB-><number>KB(<number>KB), <number>ms
104+ *
105+ * @param event event where result of parsing is to be stored
106+ * @param line line to be parsed
107+ * @param pos position where parsing should start
108+ * @throws ParseException is thrown to report any problems the parser runs into
109+ */
89110 protected void setMemoryAndPauses (GCEvent event , String line , ParsePosition pos ) throws ParseException {
90111 setMemory (event , line , pos );
91112 parsePause (event , line , pos );
0 commit comments