-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial unified G1 details parsing + bug fixes.
- Loading branch information
mmillson
committed
Dec 13, 2018
1 parent
8887462
commit 2662651
Showing
39 changed files
with
2,576 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
src/main/java/org/eclipselabs/garbagecat/domain/jdk/unified/FooterHeapEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/********************************************************************************************************************** | ||
* garbagecat * | ||
* * | ||
* Copyright (c) 2008-2016 Red Hat, Inc. * | ||
* * | ||
* All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse * | ||
* Public License v1.0 which accompanies this distribution, and is available at * | ||
* http://www.eclipse.org/legal/epl-v10.html. * | ||
* * | ||
* Contributors: * | ||
* Red Hat, Inc. - initial API and implementation * | ||
*********************************************************************************************************************/ | ||
package org.eclipselabs.garbagecat.domain.jdk.unified; | ||
|
||
import org.eclipselabs.garbagecat.domain.LogEvent; | ||
import org.eclipselabs.garbagecat.domain.ThrowAwayEvent; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkRegEx; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkUtil; | ||
|
||
/** | ||
* <p> | ||
* FOOTER_HEAP | ||
* </p> | ||
* | ||
* <p> | ||
* Heap information printed at the end of gc logging with unified detailed logging | ||
* (<code>-Xlog:gc*:file=<file></code>). | ||
* </p> | ||
* | ||
* <h3>Example Logging</h3> | ||
* | ||
* <pre> | ||
* [25.016s][info][gc,heap,exit ] Heap | ||
* [25.016s][info][gc,heap,exit ] garbage-first heap total 59392K, used 38015K [0x00000000fc000000, 0x0000000100000000) | ||
* [25.016s][info][gc,heap,exit ] region size 1024K, 13 young (13312K), 1 survivors (1024K) | ||
* [25.016s][info][gc,heap,exit ] Metaspace used 11079K, capacity 11287K, committed 11520K, reserved 1060864K | ||
* [25.016s][info][gc,heap,exit ] class space used 909K, capacity 995K, committed 1024K, reserved 1048576K | ||
* </pre> | ||
* | ||
* @author <a href="mailto:mmillson@redhat.com">Mike Millson</a> | ||
* | ||
*/ | ||
public class FooterHeapEvent implements UnifiedLogging, LogEvent, ThrowAwayEvent { | ||
|
||
/** | ||
* Regular expression for heap line. | ||
*/ | ||
private static final String REGEX_HEAP = "^\\[" + JdkRegEx.TIMESTAMP + "s\\]\\[info\\]\\[gc,heap,exit \\] Heap$"; | ||
|
||
/** | ||
* Regular expression for garbage-first line. | ||
*/ | ||
private static final String REGEX_GARBAGE_FIRST = "^\\[" + JdkRegEx.TIMESTAMP | ||
+ "s\\]\\[info\\]\\[gc,heap,exit \\] garbage-first heap total " + JdkRegEx.SIZE + ", used " | ||
+ JdkRegEx.SIZE + " \\[" + JdkRegEx.ADDRESS + ", " + JdkRegEx.ADDRESS + "\\)$"; | ||
|
||
/** | ||
* Regular expression for region line. | ||
*/ | ||
private static final String REGEX_REGION = "^\\[" + JdkRegEx.TIMESTAMP | ||
+ "s\\]\\[info\\]\\[gc,heap,exit \\] region size " + JdkRegEx.SIZE + ", \\d{1,2} young \\(" | ||
+ JdkRegEx.SIZE + "\\), \\d{1} survivors \\(" + JdkRegEx.SIZE + "\\)$"; | ||
|
||
/** | ||
* Regular expression for metaspace line. | ||
*/ | ||
private static final String REGEX_METASPACE = "^\\[" + JdkRegEx.TIMESTAMP | ||
+ "s\\]\\[info\\]\\[gc,heap,exit \\] Metaspace used " + JdkRegEx.SIZE + ", capacity " | ||
+ JdkRegEx.SIZE + ", committed " + JdkRegEx.SIZE + ", reserved " + JdkRegEx.SIZE + "$"; | ||
|
||
/** | ||
* Regular expression for class line. | ||
*/ | ||
private static final String REGEX_CLASS = "^\\[" + JdkRegEx.TIMESTAMP | ||
+ "s\\]\\[info\\]\\[gc,heap,exit \\] class space used " + JdkRegEx.SIZE + ", capacity " | ||
+ JdkRegEx.SIZE + ", committed " + JdkRegEx.SIZE + ", reserved " + JdkRegEx.SIZE + "$"; | ||
|
||
/** | ||
* The log entry for the event. Can be used for debugging purposes. | ||
*/ | ||
private String logEntry; | ||
|
||
/** | ||
* The time when the GC event started in milliseconds after JVM startup. | ||
*/ | ||
private long timestamp; | ||
|
||
/** | ||
* Create event from log entry. | ||
* | ||
* @param logEntry | ||
* The log entry for the event. | ||
*/ | ||
public FooterHeapEvent(String logEntry) { | ||
this.logEntry = logEntry; | ||
this.timestamp = 0L; | ||
} | ||
|
||
public String getLogEntry() { | ||
return logEntry; | ||
} | ||
|
||
public String getName() { | ||
return JdkUtil.LogEventType.FOOTER_HEAP.toString(); | ||
} | ||
|
||
public long getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
/** | ||
* Determine if the logLine matches the logging pattern(s) for this event. | ||
* | ||
* @param logLine | ||
* The log line to test. | ||
* @return true if the log line matches the event pattern, false otherwise. | ||
*/ | ||
public static final boolean match(String logLine) { | ||
return (logLine.matches(REGEX_HEAP) || logLine.matches(REGEX_GARBAGE_FIRST) || logLine.matches(REGEX_REGION) | ||
|| logLine.matches(REGEX_METASPACE) || logLine.matches(REGEX_CLASS)); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
src/main/java/org/eclipselabs/garbagecat/domain/jdk/unified/HeapAddressEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/********************************************************************************************************************** | ||
* garbagecat * | ||
* * | ||
* Copyright (c) 2008-2016 Red Hat, Inc. * | ||
* * | ||
* All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse * | ||
* Public License v1.0 which accompanies this distribution, and is available at * | ||
* http://www.eclipse.org/legal/epl-v10.html. * | ||
* * | ||
* Contributors: * | ||
* Red Hat, Inc. - initial API and implementation * | ||
*********************************************************************************************************************/ | ||
package org.eclipselabs.garbagecat.domain.jdk.unified; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
import org.eclipselabs.garbagecat.domain.LogEvent; | ||
import org.eclipselabs.garbagecat.domain.ThrowAwayEvent; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkRegEx; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkUtil; | ||
|
||
/** | ||
* <p> | ||
* HEAP_ADDRESS | ||
* </p> | ||
* | ||
* <p> | ||
* Heap address information printed at the beginning gc logging with unified detailed logging | ||
* (<code>-Xlog:gc*:file=<file></code>). | ||
* </p> | ||
* | ||
* <h3>Example Logging</h3> | ||
* | ||
* <pre> | ||
* [0.004s][info][gc,heap,coops] Heap address: 0x00000000fc000000, size: 64 MB, Compressed Oops mode: 32-bit | ||
* </pre> | ||
* | ||
* @author <a href="mailto:mmillson@redhat.com">Mike Millson</a> | ||
* | ||
*/ | ||
public class HeapAddressEvent implements UnifiedLogging, LogEvent, ThrowAwayEvent { | ||
|
||
/** | ||
* Regular expressions defining the logging. | ||
*/ | ||
private static final String REGEX = "^\\[" + JdkRegEx.TIMESTAMP + "s\\]\\[info\\]\\[gc,heap,coops\\] Heap address: " | ||
+ JdkRegEx.ADDRESS + ", size: \\d{1,8} MB, Compressed Oops mode: 32-bit$"; | ||
|
||
private static final Pattern pattern = Pattern.compile(REGEX); | ||
|
||
/** | ||
* The log entry for the event. Can be used for debugging purposes. | ||
*/ | ||
private String logEntry; | ||
|
||
/** | ||
* The time when the GC event started in milliseconds after JVM startup. | ||
*/ | ||
private long timestamp; | ||
|
||
/** | ||
* Create event from log entry. | ||
* | ||
* @param logEntry | ||
* The log entry for the event. | ||
*/ | ||
public HeapAddressEvent(String logEntry) { | ||
this.logEntry = logEntry; | ||
this.timestamp = 0L; | ||
} | ||
|
||
public String getLogEntry() { | ||
return logEntry; | ||
} | ||
|
||
public String getName() { | ||
return JdkUtil.LogEventType.HEAP_ADDRESS.toString(); | ||
} | ||
|
||
public long getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
/** | ||
* Determine if the logLine matches the logging pattern(s) for this event. | ||
* | ||
* @param logLine | ||
* The log line to test. | ||
* @return true if the log line matches the event pattern, false otherwise. | ||
*/ | ||
public static final boolean match(String logLine) { | ||
return pattern.matcher(logLine).matches(); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
src/main/java/org/eclipselabs/garbagecat/domain/jdk/unified/HeapRegionSizeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/********************************************************************************************************************** | ||
* garbagecat * | ||
* * | ||
* Copyright (c) 2008-2016 Red Hat, Inc. * | ||
* * | ||
* All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse * | ||
* Public License v1.0 which accompanies this distribution, and is available at * | ||
* http://www.eclipse.org/legal/epl-v10.html. * | ||
* * | ||
* Contributors: * | ||
* Red Hat, Inc. - initial API and implementation * | ||
*********************************************************************************************************************/ | ||
package org.eclipselabs.garbagecat.domain.jdk.unified; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
import org.eclipselabs.garbagecat.domain.LogEvent; | ||
import org.eclipselabs.garbagecat.domain.ThrowAwayEvent; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkRegEx; | ||
import org.eclipselabs.garbagecat.util.jdk.JdkUtil; | ||
|
||
/** | ||
* <p> | ||
* HEAP_REGION_SIZE | ||
* </p> | ||
* | ||
* <p> | ||
* Heap region size information printed at the beginning gc logging with unified detailed logging | ||
* (<code>-Xlog:gc*:file=<file></code>). | ||
* </p> | ||
* | ||
* <h3>Example Logging</h3> | ||
* | ||
* <pre> | ||
* [0.003s][info][gc,heap] Heap region size: 1M | ||
* </pre> | ||
* | ||
* @author <a href="mailto:mmillson@redhat.com">Mike Millson</a> | ||
* | ||
*/ | ||
public class HeapRegionSizeEvent implements UnifiedLogging, LogEvent, ThrowAwayEvent { | ||
|
||
/** | ||
* Regular expressions defining the logging. | ||
*/ | ||
private static final String REGEX = "^\\[" + JdkRegEx.TIMESTAMP + "s\\]\\[info\\]\\[gc,heap\\] Heap region size: " | ||
+ JdkRegEx.SIZE + "$"; | ||
|
||
private static final Pattern pattern = Pattern.compile(REGEX); | ||
|
||
/** | ||
* The log entry for the event. Can be used for debugging purposes. | ||
*/ | ||
private String logEntry; | ||
|
||
/** | ||
* The time when the GC event started in milliseconds after JVM startup. | ||
*/ | ||
private long timestamp; | ||
|
||
/** | ||
* Create event from log entry. | ||
* | ||
* @param logEntry | ||
* The log entry for the event. | ||
*/ | ||
public HeapRegionSizeEvent(String logEntry) { | ||
this.logEntry = logEntry; | ||
this.timestamp = 0L; | ||
} | ||
|
||
public String getLogEntry() { | ||
return logEntry; | ||
} | ||
|
||
public String getName() { | ||
return JdkUtil.LogEventType.HEAP_REGION_SIZE.toString(); | ||
} | ||
|
||
public long getTimestamp() { | ||
return timestamp; | ||
} | ||
|
||
/** | ||
* Determine if the logLine matches the logging pattern(s) for this event. | ||
* | ||
* @param logLine | ||
* The log line to test. | ||
* @return true if the log line matches the event pattern, false otherwise. | ||
*/ | ||
public static final boolean match(String logLine) { | ||
return pattern.matcher(logLine).matches(); | ||
} | ||
} |
Oops, something went wrong.