diff --git a/htroot/PeerLoadPicture.java b/htroot/PeerLoadPicture.java index c82e78546..cb9677383 100644 --- a/htroot/PeerLoadPicture.java +++ b/htroot/PeerLoadPicture.java @@ -62,9 +62,14 @@ public class PeerLoadPicture { // set respective angles Iterator it = pieces.values().iterator(); + CircleThreadPiece current; while (it.hasNext()) { - ((CircleThreadPiece)it.next()).setAngle(busy_time); + current = (CircleThreadPiece)it.next(); + current.setFraction(busy_time); + //remove unneccessary elements + if(current.getAngle() == 0) it.remove(); } + misc.setFraction(busy_time); // too small values lead to an error, too big to huge CPU/memory consumption, // resulting in possible DOS. diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.java index 41f161f4c..f494919f1 100644 --- a/source/de/anomic/plasma/plasmaGrafics.java +++ b/source/de/anomic/plasma/plasmaGrafics.java @@ -88,14 +88,15 @@ public class plasmaGrafics { private final String pieceName; private final Color color; private long execTime = 0; - private int angle = 0; + private float fraction = 0; public CircleThreadPiece(String pieceName, Color color) { this.pieceName = pieceName; this.color = color; } - public int getAngle() { return this.angle; } + public int getAngle() { return (int)Math.round(360f*this.fraction); } + public int getFractionPercent() { return (int)Math.round(100f*this.fraction); } public Color getColor() { return this.color; } public long getExecTime() { return this.execTime; } public String getPieceName() { return this.pieceName; } @@ -103,11 +104,11 @@ public class plasmaGrafics { public void addExecTime(long execTime) { this.execTime += execTime; } public void reset() { this.execTime = 0; - this.angle = 0; + this.fraction = 0; } public void setExecTime(long execTime) { this.execTime = execTime; } - public void setAngle(long totalBusyTime) { - this.angle = (int)Math.round(360f * ((float)this.execTime / (float)totalBusyTime)); + public void setFraction(long totalBusyTime) { + this.fraction = (float)this.execTime / (float)totalBusyTime; } } @@ -316,24 +317,24 @@ public class plasmaGrafics { int circ_w = Math.min(width,height)-20; //width of the circle (r*2) int circ_x = width-circ_w-10; //x-coordinate of circle-left int circ_y = 10; //y-coordinate of circle-top - int curr_arc = 0; //remember current angle + int curr_angle = 0; //remember current angle int i; for (i=0; i