# HG changeset patch # User shade # Date 1505476790 -7200 # Node ID 97914d0e20b082220ab9dd40a505999330a404de # Parent db3d17330c0a0ed1748e4a62f59d67d54a3dc83a Update color coding. diff -r db3d17330c0a -r 97914d0e20b0 src/main/java/org/openjdk/shenandoah/Colors.java --- a/src/main/java/org/openjdk/shenandoah/Colors.java Fri Sep 15 12:38:48 2017 +0200 +++ b/src/main/java/org/openjdk/shenandoah/Colors.java Fri Sep 15 13:59:50 2017 +0200 @@ -9,17 +9,22 @@ static final Color TIMELINE_EVACUATING = new Color(100, 0, 0); static final Color TIMELINE_UPDATEREFS = new Color(0, 100, 100); - static final Color SHARED_ALLOC = new Color(250, 129, 0); - static final Color SHARED_ALLOC_BORDER = new Color(142, 71, 0); - static final Color TLAB_ALLOC = new Color(0, 250, 250); - static final Color TLAB_ALLOC_BORDER = new Color(0, 191, 190); + static final Color SHARED_ALLOC = new Color(0, 250, 250); + static final Color SHARED_ALLOC_BORDER = new Color(0, 191, 190); + static final Color TLAB_ALLOC = new Color(0, 200, 0); + static final Color TLAB_ALLOC_BORDER = new Color(0, 100, 0); static final Color GCLAB_ALLOC = new Color(185, 0, 250); static final Color GCLAB_ALLOC_BORDER = new Color(118, 0, 160); - static final Color USED = new Color(150, 150, 150); - static final Color LIVE = new Color(0, 200, 0); + + static final Color USED = new Color(220, 220, 220); + + static final Color LIVE_REGULAR = new Color(0, 200, 0); + static final Color LIVE_HUMONGOUS = new Color(250, 100, 0); + static final Color LIVE_CSET = new Color(250, 250, 0); + static final Color LIVE_TRASH = new Color(100, 100, 100); + static final Color LIVE_PINNED = new Color(255, 0, 0); + static final Color LIVE_EMPTY = new Color(255, 255, 255); + static final Color LIVE_BORDER = new Color(0, 100, 0); - static final Color CSET = Color.YELLOW; - static final Color HUMONGOUS = Color.RED; - static final Color BORDER = new Color(150, 150, 150); } diff -r db3d17330c0a -r 97914d0e20b0 src/main/java/org/openjdk/shenandoah/RegionStat.java --- a/src/main/java/org/openjdk/shenandoah/RegionStat.java Fri Sep 15 12:38:48 2017 +0200 +++ b/src/main/java/org/openjdk/shenandoah/RegionStat.java Fri Sep 15 13:59:50 2017 +0200 @@ -1,5 +1,6 @@ package org.openjdk.shenandoah; +import javax.swing.plaf.synth.Region; import java.awt.*; import java.util.BitSet; import java.util.EnumSet; @@ -64,6 +65,26 @@ } } + private Color selectLive(RegionState s) { + switch (s) { + case CSET: + return LIVE_CSET; + case HUMONGOUS: + return LIVE_HUMONGOUS; + case REGULAR: + return LIVE_REGULAR; + case TRASH: + return LIVE_TRASH; + case PINNED: + return LIVE_PINNED; + case EMPTY_COMMITTED: + case EMPTY_UNCOMMITTED: + return LIVE_EMPTY; + default: + return Color.WHITE; + } + } + public void render(Graphics g, int x, int y, int width, int height) { g.setColor(Color.WHITE); g.fillRect(x, y, width, height); @@ -73,18 +94,18 @@ g.fillRect(x, y, usedWidth, height); int liveWidth = (int) (width * liveLvl); - g.setColor(LIVE); + g.setColor(selectLive(state)); g.fillRect(x, y, liveWidth, height); g.setColor(LIVE_BORDER); g.drawLine(x + liveWidth, y, x + liveWidth, y + height); - if (gclabLvl > 0 || tlabLvl > 0 || sharedLvl > 0) { - int sharedWidth = (int) (width * sharedLvl); - int tlabWidth = (int) (width * tlabLvl); - int gclabWidth = (int) (width * gclabLvl); + if (state == RegionState.REGULAR && (gclabLvl > 0 || tlabLvl > 0 || sharedLvl > 0)) { + int sharedWidth = (int) (liveWidth * sharedLvl); + int tlabWidth = (int) (liveWidth * tlabLvl); + int gclabWidth = (int) (liveWidth * gclabLvl); - int h = height / 3; + int h = height; int ly = y + (height - h); int lx = x; @@ -106,31 +127,12 @@ g.drawRect(lx, ly, sharedWidth, h); } - if (state == RegionState.CSET) { - g.setColor(Colors.CSET); - g.fillRect(x, y, width, height / 3); - g.setColor(Color.BLACK); - g.drawRect(x, y, width, height / 3); - } - - if (state == RegionState.HUMONGOUS) { - g.setColor(Colors.HUMONGOUS); - g.fillRect(x, y, width, height / 3); - g.setColor(Color.BLACK); - g.drawRect(x, y, width, height / 3); - } - - if (state == RegionState.EMPTY_UNCOMMITTED || state == RegionState.EMPTY_COMMITTED) { + if (state == RegionState.EMPTY_UNCOMMITTED) { g.setColor(Color.BLACK); g.drawLine(x, y, x + width, y + height); g.drawLine(x, y + height, x + width, y); } - if (state == RegionState.PINNED) { - g.setColor(Color.RED); - g.fillOval(x + width/2, y + height/2, width/4, height/4); - } - g.setColor(Colors.BORDER); g.drawRect(x, y, width, height); } diff -r db3d17330c0a -r 97914d0e20b0 src/main/java/org/openjdk/shenandoah/RegionState.java --- a/src/main/java/org/openjdk/shenandoah/RegionState.java Fri Sep 15 12:38:48 2017 +0200 +++ b/src/main/java/org/openjdk/shenandoah/RegionState.java Fri Sep 15 13:59:50 2017 +0200 @@ -20,8 +20,8 @@ static RegionState fromOrdinal(int idx) { switch (idx) { - case 0: return EMPTY_COMMITTED; - case 1: return EMPTY_UNCOMMITTED; + case 0: return EMPTY_UNCOMMITTED; + case 1: return EMPTY_COMMITTED; case 2: return REGULAR; case 3: return HUMONGOUS; case 4: return HUMONGOUS; diff -r db3d17330c0a -r 97914d0e20b0 src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java --- a/src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java Fri Sep 15 12:38:48 2017 +0200 +++ b/src/main/java/org/openjdk/shenandoah/ShenandoahVisualizer.java Fri Sep 15 13:59:50 2017 +0200 @@ -228,11 +228,11 @@ g.drawRect(x, (int) Math.round(graphHeight - s.tlabAllocs() * stepY), 1, 1); g.setColor(Colors.GCLAB_ALLOC); g.drawRect(x, (int) Math.round(graphHeight - s.gclabAllocs() * stepY), 1, 1); - g.setColor(Colors.HUMONGOUS); + g.setColor(Colors.LIVE_HUMONGOUS); g.drawRect(x, (int) Math.round(graphHeight - s.humongous() * stepY), 1, 1); - g.setColor(Colors.LIVE); + g.setColor(Colors.LIVE_REGULAR); g.drawRect(x, (int) Math.round(graphHeight - s.live() * stepY), 1, 1); - g.setColor(Colors.CSET); + g.setColor(Colors.LIVE_CSET); g.drawRect(x, (int) Math.round(graphHeight - s.collectionSet() * stepY), 1, 1); } } @@ -242,10 +242,10 @@ Map items = new LinkedHashMap<>(); - items.put("Empty (uncommitted)", + items.put("Empty Uncommitted", new RegionStat(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, EMPTY_UNCOMMITTED)); - items.put("Empty (committed)", + items.put("Empty Committed", new RegionStat(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, EMPTY_COMMITTED)); items.put("1/2 Used", @@ -254,31 +254,28 @@ items.put("Fully Used", new RegionStat(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, REGULAR)); - items.put("Fully Used, 100% TLAB Allocs", - new RegionStat(1.0f, 0.0f, 1.0f, 0.0f, 0.0f, REGULAR)); + items.put("Fully Live, 100% TLAB Allocs", + new RegionStat(1.0f, 1.0f, 1.0f, 0.0f, 0.0f, REGULAR)); - items.put("Fully Used, 100% GCLAB Allocs", - new RegionStat(1.0f, 0.0f, 0.0f, 1.0f, 0.0f, REGULAR)); - - items.put("Fully Used, 100% Shared Allocs", - new RegionStat(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, REGULAR)); + items.put("Fully Live, 100% GCLAB Allocs", + new RegionStat(1.0f, 1.0f, 0.0f, 1.0f, 0.0f, REGULAR)); - items.put("Fully Used, 50%/50% TLAB/GCLAB Allocs", - new RegionStat(1.0f, 0.0f, 0.5f, 0.5f, 0.0f, REGULAR)); + items.put("Fully Live, 100% Shared Allocs", + new RegionStat(1.0f, 1.0f, 0.0f, 0.0f, 1.0f, REGULAR)); - items.put("Fully Used, 33%/33%/33% T/GC/S Allocs", - new RegionStat(1.0f, 0.0f, 1f/3, 1f/3, 1f/3, REGULAR)); + items.put("Fully Live, 50%/50% TLAB/GCLAB Allocs", + new RegionStat(1.0f, 1.0f, 0.5f, 0.5f, 0.0f, REGULAR)); - items.put("Fully Live", - new RegionStat(1.0f, 1.0f, 0.0f, 0.0f, 0.0f, REGULAR)); + items.put("Fully Live, 33%/33%/33% T/GC/S Allocs", + new RegionStat(1.0f, 1.0f, 1f/3, 1f/3, 1f/3, REGULAR)); - items.put("Fully Live + Humongous", + items.put("Fully Live Humongous", new RegionStat(1.0f, 1.0f, 0.0f, 0.0f, 0.0f, HUMONGOUS)); items.put("1/3 Live", new RegionStat(1.0f, 0.3f, 0.0f, 0.0f, 0.0f, REGULAR)); - items.put("1/3 Live + In Collection Set", + items.put("1/3 Live + Collection Set", new RegionStat(1.0f, 0.3f, 0.0f, 0.0f, 0.0f, CSET)); items.put("1/3 Live + Pinned",