Skip to content

Commit

Permalink
draw all Total...Renderer as polygons between *end* of pauses -> resu…
Browse files Browse the repository at this point in the history
…lts in jagged lines (not rectangular any more) (chewiebug#111)
  • Loading branch information
chewiebug committed Nov 23, 2014
1 parent be5e2eb commit 6a0d449
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public Polygon computePolygon(ModelChart modelChart, GCModel model) {
if (event.getTotal() > 0) {
// there are events that don't have a heap size associated (like "GC remark" of G1)
// -> skip them
polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp(), event.getTotal());
if (polygon.npoints == 1) {
// first point needs to be treated different from the rest,
// because otherwise the polygon would not start with a vertical line at 0,
// but with a slanting line between 0 and after the first pause
polygon.addPoint(0, (double)event.getTotal());
}
polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp() + event.getPause(), event.getTotal());
lastTotal = event.getTotal();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,22 @@ public TotalTenuredRenderer(ModelChartImpl modelChart) {
public Polygon computePolygon(ModelChart modelChart, GCModel model) {
ScaledPolygon polygon = createMemoryScaledPolygon();
polygon.addPoint(0.0d, 0.0d);
double lastTotal = 0.0d;
double lastTotal = 0;
for (Iterator<AbstractGCEvent<?>> i = model.getStopTheWorldEvents(); i.hasNext();) {
AbstractGCEvent<?> abstractGCEvent = i.next();
if (abstractGCEvent instanceof GCEvent) {
GCEvent event = (GCEvent) abstractGCEvent;
GCEvent tenured = event.getTenured();
if (hasMemoryInformation(event) && tenured != null) {
double total = tenured.getTotal();
if (polygon.npoints == 1) {
// first point needs to be treated different from the rest,
// because otherwise the polygon would not start with a vertical line at 0,
// but with a slanting line between 0 and after the first pause
polygon.addPoint(0.0d, total);
lastTotal = total;
polygon.addPoint(0, (double)tenured.getTotal());
}

if (lastTotal != total) {
polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp(), lastTotal);
}
polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp() + tenured.getPause(), total);
lastTotal = total;
polygon.addPoint(tenured.getTimestamp() - model.getFirstPauseTimeStamp() + event.getPause(),
tenured.getTotal());
lastTotal = tenured.getTotal();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ public Polygon computePolygon(ModelChart modelChart, GCModel model) {
// because otherwise the polygon would not start with a vertical line at 0,
// but with a slanting line between 0 and after the first pause
polygon.addPoint(0, tenuredSize + youngSize);
lastYoung = youngSize;
lastTenured = tenuredSize;
}
if (((lastTenured + lastYoung) - (tenuredSize + youngSize)) > 0.0000001) {
polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp(), lastTenured + lastYoung);
}
polygon.addPoint(event.getTimestamp() - model.getFirstPauseTimeStamp() + event.getPause(), tenuredSize + youngSize);
lastYoung = youngSize;
Expand Down

0 comments on commit 6a0d449

Please sign in to comment.