Mercurial > hg > shenandoah-visualizer
changeset 14:f273c5864a03
Decode new Shenandoah protocol.
author | shade |
---|---|
date | Wed, 01 Feb 2017 00:09:01 +0100 |
parents | 128b8539ab74 |
children | fac0698361e5 |
files | src/main/java/org/openjdk/shenandoah/RegionStat.java src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java |
diffstat | 2 files changed, 50 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/openjdk/shenandoah/RegionStat.java Fri Dec 16 16:58:29 2016 +0100 +++ b/src/main/java/org/openjdk/shenandoah/RegionStat.java Wed Feb 01 00:09:01 2017 +0100 @@ -4,26 +4,30 @@ public class RegionStat { - private static final int USED_MASK = 0x3fffffff; + private static final int USED_MASK = 0x1fffffff; private static final int USED_SHIFT = 0; - private static final int LIVE_MASK = 0x3fffffff; - private static final int LIVE_SHIFT = 30; - private static final int FLAGS_MASK = 0xf; - private static final int FLAGS_SHIFT = 60; + private static final int LIVE_MASK = 0x1fffffff; + private static final int LIVE_SHIFT = 29; + private static final int FLAGS_MASK = 0x3f; + private static final int FLAGS_SHIFT = 58; private final boolean unused; private final boolean humongous; private final boolean inCset; + private final boolean newlyAllocated; + private final boolean pinned; private final double liveLvl; private final double usedLvl; private long ma; - public RegionStat(double usedLvl, double liveLvl, boolean unused, boolean humongous, boolean inCset) { + public RegionStat(double usedLvl, double liveLvl, boolean unused, boolean humongous, boolean inCset, boolean newlyAllocated) { this.usedLvl = usedLvl; this.liveLvl = liveLvl; this.unused = unused; this.humongous = humongous; this.inCset = inCset; + this.newlyAllocated = newlyAllocated; + this.pinned = false; } public RegionStat(long maxSize, long data) { @@ -34,9 +38,11 @@ liveLvl = Math.min(1D, 1D * live / maxSize); long stat = (data >>> FLAGS_SHIFT) & FLAGS_MASK; - inCset = (stat & 0x1) > 0; - humongous = (stat & 0x2) > 0; - unused = (stat & 0x4) > 0; + unused = (stat & 1) > 0; + inCset = (stat & 2) > 0; + humongous = (stat & 4) > 0; + newlyAllocated = (stat & 8) > 0; + pinned = (stat & 16) > 0; } public void render(Graphics g, int x, int y, int width, int height) { @@ -44,15 +50,21 @@ g.fillRect(x, y, width, height); int usedWidth = (int) (width * usedLvl); - g.setColor(new Color(150, 150, 150)); + g.setColor( + newlyAllocated ? + new Color(0, 250, 250) : + new Color(150, 150, 150) + ); g.fillRect(x, y, usedWidth, height); - int liveWidth = (int) (width * liveLvl); - g.setColor(new Color(0, 200, 0)); - g.fillRect(x, y, liveWidth, height); + if (!newlyAllocated) { + int liveWidth = (int) (width * liveLvl); + g.setColor(new Color(0, 200, 0)); + g.fillRect(x, y, liveWidth, height); - g.setColor(new Color(0, 100, 0)); - g.drawLine(x + liveWidth, y, x + liveWidth, y + height); + g.setColor(new Color(0, 100, 0)); + g.drawLine(x + liveWidth, y, x + liveWidth, y + height); + } if (inCset) { g.setColor(Color.YELLOW); @@ -73,6 +85,12 @@ g.drawLine(x, y, x + width, y + height); g.drawLine(x, y + height, x + width, y); } + + if (pinned) { + g.setColor(Color.RED); + g.fillOval(x + width/2, y + height/2, width/4, height/4); + } + g.setColor(Color.BLACK); g.drawRect(x, y, width, height); }
--- a/src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java Fri Dec 16 16:58:29 2016 +0100 +++ b/src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java Wed Feb 01 00:09:01 2017 +0100 @@ -84,6 +84,15 @@ renderedImage = render(cur, width, height); lastSnapshot = cur; } + long max = cur.total() / 1024 / 1024; + System.out.format("%d, %d, %d, %d, %d, %d, %n", + cur.time() - START_TIME, + max, + cur.isMarking() ? max : 0, + cur.isEvacuating() ? max : 0, + cur.live() / 1024 / 1024, + cur.used() / 1024 / 1024 + ); frame.repaint(); }, 0, 100, TimeUnit.MILLISECONDS); @@ -148,28 +157,28 @@ Map<String, RegionStat> items = new LinkedHashMap<>(); items.put("Unused", - new RegionStat(0.0, 0.0, true, false, false)); + new RegionStat(0.0, 0.0, true, false, false, false)); items.put("Empty", - new RegionStat(0.0, 0.0, false, false, false)); + new RegionStat(0.0, 0.0, false, false, false, false)); items.put("1/2 Used", - new RegionStat(0.5, 0.0, false, false, false)); + new RegionStat(0.5, 0.0, false, false, false, false)); items.put("Fully Used", - new RegionStat(1.0, 0.0, false, false, false)); + new RegionStat(1.0, 0.0, false, false, false, false)); items.put("Fully Live", - new RegionStat(1.0, 1.0, false, false, false)); + new RegionStat(1.0, 1.0, false, false, false, false)); items.put("Fully Live + Humongous", - new RegionStat(1.0, 1.0, false, true, false)); + new RegionStat(1.0, 1.0, false, true, false, false)); items.put("1/3 Live", - new RegionStat(1.0, 0.3, false, false, false)); + new RegionStat(1.0, 0.3, false, false, false, false)); items.put("1/3 Live + In Collection Set", - new RegionStat(1.0, 0.3, false, false, true)); + new RegionStat(1.0, 0.3, false, false, true, false)); { int i = 1;