Skip to content

Added graphical differences for System Full GC, it allows to select #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 37 additions & 41 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/mac">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/mac">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
12 changes: 12 additions & 0 deletions src/main/java/com/tagtraum/perf/gcviewer/GCDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,18 @@ public boolean isShowDateStamp() {
return chartPanelViews.get(0).getModelChart().isShowDateStamp();

}

@Override
public boolean isShowSystemFullGCLines() {
if (chartPanelViews.isEmpty()) return false;
return chartPanelViews.get(0).getModelChart().isShowSystemFullGCLines();
}

@Override
public void setShowSystemFullGCLines(boolean showSystemFullGCLines) {
for (ChartPanelView chartPanelView : chartPanelViews)
chartPanelView.getModelChart().setShowSystemFullGCLines(showSystemFullGCLines);
}
}

private class ScrollBarMaximumChangeListener implements ChangeListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
public class GCPreferences {
public static final String FULL_GC_LINES = "fullgclines";
public static final String SYSTEM_FULL_GC_LINES = "systemfullgclines";
public static final String INC_GC_LINES = "incgclines";
public static final String GC_LINES_LINE = "gctimesline";
public static final String GC_TIMES_RECTANGLES = "gctimesrectangles";
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/tagtraum/perf/gcviewer/GCViewerGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.tagtraum.perf.gcviewer.renderer.GCTimesRenderer;
import com.tagtraum.perf.gcviewer.renderer.IncLineRenderer;
import com.tagtraum.perf.gcviewer.renderer.InitialMarkLevelRenderer;
import com.tagtraum.perf.gcviewer.renderer.SystemFullGCLineRenderer;
import com.tagtraum.perf.gcviewer.renderer.TotalHeapRenderer;
import com.tagtraum.perf.gcviewer.renderer.TotalTenuredRenderer;
import com.tagtraum.perf.gcviewer.renderer.TotalYoungRenderer;
Expand Down Expand Up @@ -111,6 +112,7 @@ public class GCViewerGui extends JFrame {
private JCheckBoxMenuItem menuItemShowDataPanel;
private JCheckBoxMenuItem menuItemShowDateStamp;
private JCheckBoxMenuItem menuItemFullGCLines;
private JCheckBoxMenuItem menuItemSystemFullGCLines;
private JCheckBoxMenuItem menuItemIncGCLines;
private JCheckBoxMenuItem menuItemGcTimesLine;
private JCheckBoxMenuItem menuItemGcTimesRectangle;
Expand Down Expand Up @@ -284,6 +286,7 @@ private void updateMenuItemState() {
menuItemShowDateStamp.setState(getSelectedGCDocument().getModelChart().isShowDateStamp());
menuItemAntiAlias.setSelected(getSelectedGCDocument().getModelChart().isAntiAlias());
menuItemFullGCLines.setState(getSelectedGCDocument().getModelChart().isShowFullGCLines());
menuItemSystemFullGCLines.setState(getSelectedGCDocument().getModelChart().isShowSystemFullGCLines());
menuItemIncGCLines.setState(getSelectedGCDocument().getModelChart().isShowIncGCLines());
menuItemGcTimesLine.setState(getSelectedGCDocument().getModelChart().isShowGCTimesLine());
menuItemGcTimesRectangle.setState(getSelectedGCDocument().getModelChart().isShowGCTimesRectangles());
Expand Down Expand Up @@ -540,6 +543,16 @@ public void actionPerformed(final ActionEvent e) {
viewMenu.add(menuItemFullGCLines);
gcLineMenuItems.put(GCPreferences.FULL_GC_LINES, menuItemFullGCLines);

menuItemSystemFullGCLines = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_system_full_gc_lines"), true);
menuItemSystemFullGCLines.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_system_full_gc_lines").charAt(0));
menuItemSystemFullGCLines.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_system_full_gc_lines"));
menuItemSystemFullGCLines.setIcon(createMonoColoredImageIcon(SystemFullGCLineRenderer.DEFAULT_LINEPAINT, 20, 20));
menuItemSystemFullGCLines.setActionCommand(GCPreferences.SYSTEM_FULL_GC_LINES);
menuItemSystemFullGCLines.addActionListener(viewMenuActionListener);
viewMenu.add(menuItemSystemFullGCLines);
gcLineMenuItems.put(GCPreferences.SYSTEM_FULL_GC_LINES, menuItemSystemFullGCLines);


menuItemIncGCLines = new JCheckBoxMenuItem(LocalisationHelper.getString("main_frame_menuitem_inc_gc_lines"), true);
menuItemIncGCLines.setMnemonic(LocalisationHelper.getString("main_frame_menuitem_mnemonic_inc_gc_lines").charAt(0));
menuItemIncGCLines.setToolTipText(LocalisationHelper.getString("main_frame_menuitem_hint_inc_gc_lines"));
Expand Down Expand Up @@ -698,6 +711,8 @@ public void actionPerformed(final ActionEvent e) {
getSelectedGCDocument().getModelChart().setShowInitialMarkLevel(((JCheckBoxMenuItem) e.getSource()).getState());
} else if (e.getActionCommand() == GCPreferences.CONCURRENT_COLLECTION_BEGIN_END) {
getSelectedGCDocument().getModelChart().setShowConcurrentCollectionBeginEnd(((JCheckBoxMenuItem) e.getSource()).getState());
}else if (e.getActionCommand() == GCPreferences.SYSTEM_FULL_GC_LINES) {
getSelectedGCDocument().getModelChart().setShowSystemFullGCLines(((JCheckBoxMenuItem) e.getSource()).getState());
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/tagtraum/perf/gcviewer/ModelChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,11 @@ public interface ModelChart {

boolean isShowDateStamp();

boolean isShowSystemFullGCLines();

void setShowSystemFullGCLines(boolean showSystemFullGCLines);




}
16 changes: 15 additions & 1 deletion src/main/java/com/tagtraum/perf/gcviewer/ModelChartImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ModelChartImpl extends JScrollPane implements ModelChart, ChangeLis
private IncLineRenderer incLineRenderer;
private GCRectanglesRenderer gcRectanglesRenderer;
private FullGCLineRenderer fullGCLineRenderer;
private SystemFullGCLineRenderer systemFullGCLineRenderer;
private GCTimesRenderer gcTimesRenderer;
private UsedHeapRenderer usedHeapRenderer;
private UsedTenuredRenderer usedTenuredRenderer;
Expand Down Expand Up @@ -77,6 +78,8 @@ public ModelChartImpl() {
chart.add(gcTimesRenderer, gridBagConstraints);
fullGCLineRenderer = new FullGCLineRenderer(this);
chart.add(fullGCLineRenderer, gridBagConstraints);
systemFullGCLineRenderer = new SystemFullGCLineRenderer(this);
chart.add(systemFullGCLineRenderer, gridBagConstraints);
gcRectanglesRenderer = new GCRectanglesRenderer(this);
chart.add(gcRectanglesRenderer, gridBagConstraints);
incLineRenderer = new IncLineRenderer(this);
Expand Down Expand Up @@ -282,7 +285,17 @@ public boolean isShowFullGCLines() {
public void setShowFullGCLines(boolean showFullGCLines) {
fullGCLineRenderer.setVisible(showFullGCLines);
}


@Override
public boolean isShowSystemFullGCLines(){
return this.systemFullGCLineRenderer.isVisible();
}

@Override
public void setShowSystemFullGCLines(boolean showSystemFullGCLines){
this.systemFullGCLineRenderer.setVisible(showSystemFullGCLines);
}

@Override
public boolean isShowIncGCLines() {
return incLineRenderer.isVisible();
Expand Down Expand Up @@ -382,6 +395,7 @@ private void applyPreferences(GCPreferences preferences) {
setShowGCTimesLine(preferences.getGcLineProperty(GCPreferences.GC_LINES_LINE));
setShowGCTimesRectangles(preferences.getGcLineProperty(GCPreferences.GC_TIMES_RECTANGLES));
setShowFullGCLines(preferences.getGcLineProperty(GCPreferences.FULL_GC_LINES));
setShowFullGCLines(preferences.getGcLineProperty(GCPreferences.SYSTEM_FULL_GC_LINES));
setShowIncGCLines(preferences.getGcLineProperty(GCPreferences.INC_GC_LINES));
setShowTotalMemoryLine(preferences.getGcLineProperty(GCPreferences.TOTAL_MEMORY));
setShowUsedMemoryLine(preferences.getGcLineProperty(GCPreferences.USED_MEMORY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected AbstractGCEvent<GCEvent> parseLine(String line, ParseInformation pos)
StringTokenizer st = new StringTokenizer(line, " ,->()K\r\n");
String token = st.nextToken();
if (token.equals("Full") && st.nextToken().equals("GC")) {
event.setType(AbstractGCEvent.Type.FULL_GC);
event.setType(AbstractGCEvent.Type.FULL_GC);
} else if (token.equals("Inc") && st.nextToken().equals("GC")) {
event.setType(AbstractGCEvent.Type.INC_GC);
} else if (token.equals("GC")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ public boolean isFull() {
return false;
}
}

public boolean isSystemFullGC(){
return this.toString().contains("[Full GC (System)");
}

public boolean isInc() {
return getExtendedType().getType() == GCEvent.Type.INC_GC;
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/tagtraum/perf/gcviewer/model/GCModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public boolean equals(Object other) {
private List<ConcurrentGCEvent> concurrentGCEvents;
private List<GCEvent> currentNoFullGCEvents;
private List<GCEvent> fullGCEvents;
private List<GCEvent> systemFullGCEvents;
private FileInformation fileInformation = new FileInformation();

private Map<String, DoubleData> fullGcEventPauses; // pause information about all full gc events for detailed output
Expand Down Expand Up @@ -139,6 +140,7 @@ public GCModel(boolean countTenuredAsFull) {
this.gcEvents = new ArrayList<GCEvent>();
this.concurrentGCEvents = new ArrayList<ConcurrentGCEvent>();
this.fullGCEvents = new ArrayList<GCEvent>();
this.systemFullGCEvents = new ArrayList<GCEvent>();
this.currentNoFullGCEvents = new ArrayList<GCEvent>();
this.currentPostGCSlope = new RegressionLine();
this.postFullGCSlope = new RegressionLine();
Expand Down Expand Up @@ -287,6 +289,10 @@ public Iterator<AbstractGCEvent<?>> getEvents() {
public Iterator<GCEvent> getFullGCEvents() {
return fullGCEvents.iterator();
}

public Iterator<GCEvent> getSystemFullGCEvents(){
return systemFullGCEvents.iterator();
}

private DoubleData getDoubleData(String key, Map<String, DoubleData> eventMap) {
DoubleData data = eventMap.get(key);
Expand Down Expand Up @@ -744,4 +750,5 @@ public String toString() {
public static final Format IBM_VERBOSE_GC = new Format("IBM -verbose:gc");
public static final Format SUN_1_2_2VERBOSE_GC = new Format("Sun 1.2.2 -verbose:gc");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public class FullGCLineRenderer extends ChartRenderer {
public static final Paint DEFAULT_LINEPAINT = Color.BLACK;

public FullGCLineRenderer(ModelChartImpl modelChart) {
super(modelChart);
setLinePaint(DEFAULT_LINEPAINT);
Expand All @@ -34,10 +34,12 @@ public void paintComponent(Graphics2D g2d) {
int lastScaledTimestamp = Integer.MIN_VALUE;
for (Iterator<GCEvent> i = getModelChart().getModel().getFullGCEvents(); i.hasNext();) {
GCEvent event = i.next();

final int scaledTimestamp = (int)(scaleFactor * (event.getTimestamp() - getModelChart().getModel().getFirstPauseTimeStamp()));
if (scaledTimestamp != lastScaledTimestamp && scaledTimestamp >= minX && scaledTimestamp <= maxX) {
g2d.drawLine(scaledTimestamp, 0, scaledTimestamp, height);
g2d.drawLine(scaledTimestamp, 0, scaledTimestamp, height);
lastScaledTimestamp = scaledTimestamp;

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.tagtraum.perf.gcviewer.renderer;

import com.tagtraum.perf.gcviewer.ChartRenderer;
import com.tagtraum.perf.gcviewer.ModelChartImpl;
import com.tagtraum.perf.gcviewer.model.GCEvent;

import java.awt.*;
import java.util.Iterator;


public class SystemFullGCLineRenderer extends ChartRenderer {
public static final Paint DEFAULT_LINEPAINT = Color.ORANGE;

public SystemFullGCLineRenderer(ModelChartImpl modelChart) {
super(modelChart);
setLinePaint(DEFAULT_LINEPAINT);
}

public void paintComponent(Graphics2D g2d) {
// make sure that we ignore the AntiAliasing flag as it does not make sense for vertical lines
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
final double scaleFactor = getModelChart().getScaleFactor();
final Rectangle clipBounds = g2d.getClipBounds();
final int minX = clipBounds.x;
final int maxX = clipBounds.x+clipBounds.width;

final int height = getHeight();
int lastScaledTimestamp = Integer.MIN_VALUE;
for (Iterator<GCEvent> i = getModelChart().getModel().getFullGCEvents(); i.hasNext();) {
GCEvent event = i.next();

final int scaledTimestamp = (int)(scaleFactor * (event.getTimestamp() - getModelChart().getModel().getFirstPauseTimeStamp()));
if (scaledTimestamp != lastScaledTimestamp && scaledTimestamp >= minX && scaledTimestamp <= maxX &&
event.isSystemFullGC() && getModelChart().isShowSystemFullGCLines()) {
g2d.drawLine(scaledTimestamp, 0, scaledTimestamp, height);
lastScaledTimestamp = scaledTimestamp;

}
}
}

}
Loading