enhanced memory chart: shows now also the size of the word cache as third vector.

The PPM is now shown without a scale, but with a new anotation at the chart entry.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5032 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent 17b7845eb5
commit ebb40d324b

@ -43,7 +43,7 @@ public class status_p {
sb.updateMySeed();
final int cacheOutSize = sb.webIndex.dhtOutCacheSize();
final long cacheMaxSize = sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);
prop.putNum("ppm", sb.webIndex.seedDB.mySeed().getPPM());
prop.putNum("ppm", sb.currentPPM());
prop.putNum("qpm", sb.webIndex.seedDB.mySeed().getQPM());
prop.putNum("wordCacheSize", sb.webIndex.dhtOutCacheSize() + sb.webIndex.dhtInCacheSize());
prop.putNum("wordCacheWSize", cacheOutSize);

@ -53,6 +53,7 @@ public class plasmaProfiling {
public static ymageMatrix performanceGraph(final int width, final int height, final String subline) {
// find maximum values for automatic graph dimension adoption
final int maxppm = (int) maxPayload("ppm", 25);
final int maxwords = (int) maxPayload("wordcache", 10000);
final long maxbytes = maxPayload("memory", 110 * 1024 * 1024);
// declare graph and set dimensions
@ -60,53 +61,73 @@ public class plasmaProfiling {
final int rightborder = 30;
final int topborder = 20;
final int bottomborder = 20;
final int leftscale = 50;
final int leftscale = 20000;
final int rightscale = 100;
final int anotscale = 50;
final int bottomscale = 60;
final int vspace = height - topborder - bottomborder;
final int hspace = width - leftborder - rightborder;
final int maxtime = 600;
ymageChart chart = new ymageChart(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "PEER PERFORMANCE GRAPH: PAGES/MINUTE and USED MEMORY", subline);
ymageChart chart = new ymageChart(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
chart.declareDimension(ymageChart.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
chart.declareDimension(ymageChart.DIMENSION_LEFT, leftscale, vspace * leftscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
chart.declareDimension(ymageChart.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "WORDS IN CACHE");
chart.declareDimension(ymageChart.DIMENSION_RIGHT, rightscale, vspace * rightscale / (int)(maxbytes / 1024 / 1024), 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
chart.declareDimension(ymageChart.DIMENSION_ANOT, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
// draw ppm
Iterator<Event> i = serverProfiling.history("ppm");
// draw chart
long time;
final long now = System.currentTimeMillis();
long bytes;
int x0 = 1, x1, y0 = 0, y1, ppm;
int x0 = 1, x1, y0 = 0, y1, ppm, words;
serverProfiling.Event event;
try {
// draw memory
Iterator<Event> i = serverProfiling.history("memory");
while (i.hasNext()) {
event = i.next();
time = event.time - now;
ppm = (int) ((Long) event.payload).longValue();
bytes = ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = ppm;
y1 = (int) (bytes / 1024 / 1024);
chart.setColor("AAAAFF");
chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x1, y1, 2, null);
chart.setColor("0000FF");
if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1);
x0 = x1; y0 = y1;
}
// draw wordcache
i = serverProfiling.history("wordcache");
x0 = 1; y0 = 0;
while (i.hasNext()) {
event = i.next();
time = event.time - now;
words = (int) ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = words;
chart.setColor("228822");
chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x1, y1, 2);
chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x1, y1, 2, null);
chart.setColor("008800");
if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_LEFT, x0, y0, x1, y1);
x0 = x1; y0 = y1;
}
// draw memory
i = serverProfiling.history("memory");
x0 = 1;
// draw ppm
i = serverProfiling.history("ppm");
x0 = 1; y0 = 0;
while (i.hasNext()) {
event = i.next();
time = event.time - now;
bytes = ((Long) event.payload).longValue();
ppm = (int) ((Long) event.payload).longValue();
x1 = (int) (time/1000);
y1 = (int) (bytes / 1024 / 1024);
chart.setColor("AAAAFF");
chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x1, y1, 2);
chart.setColor("0000FF");
if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_RIGHT, x0, y0, x1, y1);
y1 = ppm;
chart.setColor("AA8888");
if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT, x0, y0, x1, y1);
chart.setColor("AA2222");
chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT, x1, y1, 2, ppm + " PPM");
x0 = x1; y0 = y1;
}
bufferChart = chart;
} catch (final ConcurrentModificationException cme) {
chart = bufferChart;

@ -1683,7 +1683,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
if (System.currentTimeMillis() - lastPPMUpdate > 30000) {
// we don't want to do this too often
updateMySeed();
serverProfiling.update("ppm", new Long(webIndex.seedDB.mySeed().getPPM()));
serverProfiling.update("ppm", new Long(currentPPM()));
serverProfiling.update("wordcache", new Long(webIndex.cacheSize()));
lastPPMUpdate = System.currentTimeMillis();
}
serverProfiling.update("indexed", queueEntry.url().toNormalform(true, false));
@ -2092,6 +2093,14 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
crawlQueues.errorURL.push(ee);
}
public int currentPPM() {
final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
final long uptimediff = uptime - lastseedcheckuptime;
final long indexedcdiff = indexedPages - lastindexedPages;
totalPPM = (int) (indexedPages * 60 / Math.max(uptime, 1));
return Math.round(Math.max(indexedcdiff, 0f) * 60f / Math.max(uptimediff, 1f));
}
public void updateMySeed() {
if (getConfig("peerName", "anomic").equals("anomic")) {
// generate new peer name

@ -33,17 +33,18 @@ public class ymageChart extends ymageMatrix {
public static final int DIMENSION_TOP = 1;
public static final int DIMENSION_LEFT = 2;
public static final int DIMENSION_BOTTOM = 3;
public static final int DIMENSION_ANOT = 4;
int leftborder;
int rightborder;
int topborder;
int bottomborder;
int[] scales = new int[]{0,0,0,0};
int[] pixels = new int[]{0,0,0,0};
int[] offsets = new int[]{0,0,0,0};
String[] colnames = new String[]{"FFFFFF","FFFFFF","FFFFFF","FFFFFF"};
String[] colscale = new String[]{null,null,null,null};
String[] tablenames = new String[]{"","","",""};
int[] scales = new int[]{0,0,0,0,0};
int[] pixels = new int[]{0,0,0,0,0};
int[] offsets = new int[]{0,0,0,0,0};
String[] colnames = new String[]{"FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF"};
String[] colscale = new String[]{null,null,null,null,null};
String[] tablenames = new String[]{"","","","",""};
String name;
String backgroundColor, foregroundColor;
@ -83,11 +84,12 @@ public class ymageChart extends ymageMatrix {
tablenames[dimensionType] = name;
}
public void chartDot(final int dimension_x, final int dimension_y, final int coord_x, final int coord_y, final int dotsize) {
public void chartDot(final int dimension_x, final int dimension_y, final int coord_x, final int coord_y, final int dotsize, String anot) {
final int x = (coord_x - offsets[dimension_x]) * pixels[dimension_x] / scales[dimension_x];
final int y = (coord_y - offsets[dimension_y]) * pixels[dimension_y] / scales[dimension_y];
if (dotsize == 1) plot(leftborder + x, height - bottomborder - y);
else dot(leftborder + x, height - bottomborder - y, dotsize, true);
if (anot != null) ymageToolPrint.print(this, leftborder + x + dotsize + 2, height - bottomborder - y, 0, anot, -1);
}
public void chartLine(final int dimension_x, final int dimension_y, final int coord_x1, final int coord_y1, final int coord_x2, final int coord_y2) {
@ -131,7 +133,7 @@ public class ymageChart extends ymageMatrix {
}
setColor(colorNaming);
line(x - 3, y, x + 3, y);
s1 = Integer.toString(s);
s1 = (s >= 1000000 && s % 10000 == 0) ? Integer.toString(s / 1000000) + "M" : (s >= 1000 && s % 1000 == 0) ? Integer.toString(s / 1000) + "K" : Integer.toString(s);
if (s1.length() > s1max) s1max = s1.length();
ymageToolPrint.print(this, (left) ? leftborder - 4 : width - rightborder + 4, y, 0, s1, (left) ? 1 : -1);
y -= pixelperscale;
@ -156,10 +158,10 @@ public class ymageChart extends ymageMatrix {
ip.declareDimension(DIMENSION_LEFT, 50, 40, 0, green, scale , "PPM [PAGES/MINUTE]");
ip.declareDimension(DIMENSION_RIGHT, 100, 20, 0, blue, scale, "MEMORY/MEGABYTE");
ip.setColor(green);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, 5);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, 5, null);
ip.chartLine(DIMENSION_BOTTOM, DIMENSION_LEFT, -160, 100, -130, 200);
ip.setColor(blue);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_RIGHT, -50, 300, 2);
ip.chartDot(DIMENSION_BOTTOM, DIMENSION_RIGHT, -50, 300, 2, null);
ip.chartLine(DIMENSION_BOTTOM, DIMENSION_RIGHT, -80, 100, -50, 300);
//ip.print(100, 100, 0, "TEXT", true);
//ip.print(100, 100, 0, "1234", false);

Loading…
Cancel
Save