Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- performance graph does not shop peer ping in memory monitor any more - after a forced GC, the PerformanceMemory view switches to automatic update by default

Michael Peter Christenf1b5db2c4554
diff --git a/htroot/PerformanceGraph.java b/htroot/PerformanceGraph.java
index c84b44e25..7e1f34d7b 100644
--- a/htroot/PerformanceGraph.java
+++ b/htroot/PerformanceGraph.java
@@ -44,13 +44,17 @@ public class PerformanceGraph {
final int width = post.getInt("width", 660);
final int height = post.getInt("height", 240);
final boolean showMemory = !post.containsKey("nomem");
+ final boolean showPeers = !post.containsKey("nopeers");
long t = System.currentTimeMillis();
if (t - indexSizeTime > 10000) {
indeSizeCache = sb.index.fulltext().collectionSize();
indexSizeTime = t;
}
- RasterPlotter graph = ProfilingGraph.performanceGraph(width, height, indeSizeCache + " URLS / " + sb.index.RWICount() + " WORDS IN INDEX / " + sb.index.RWIBufferCount() + " WORDS IN CACHE", showMemory);
+ RasterPlotter graph = ProfilingGraph.performanceGraph(
+ width, height,
+ indeSizeCache + " URLS / " + sb.index.RWICount() + " WORDS IN INDEX / " + sb.index.RWIBufferCount() + " WORDS IN CACHE",
+ showMemory, showPeers);
return graph;
}
diff --git a/htroot/PerformanceMemory_p.html b/htroot/PerformanceMemory_p.html
index 163d8a43f..c1ef9995e 100644
--- a/htroot/PerformanceMemory_p.html
+++ b/htroot/PerformanceMemory_p.html
@@ -9,7 +9,7 @@
<script type="text/javascript"><!--
function reloadGraph() {
if(document.forms["optionreloadGraph"].option.checked)
- document.images["graph"].src="PerformanceGraph.png?time="+(new Date()).getTime();
+ document.images["graph"].src="PerformanceGraph.png?nopeers=&time="+(new Date()).getTime();
window.status="";
}
window.setInterval("reloadGraph()", 1000);
@@ -18,8 +18,8 @@
#%env/templates/submenuComputation.template%#
<h2>Performance Settings for Memory</h2>
- <p><img src="PerformanceGraph.png" id="graph" alt="PerformanceGraph"/></p>
- <form id="optionreloadGraph" action="" method="get"><p><input type="checkbox" name="option" id="autoreload"/> <label for="autoreload">refresh graph</label></p></form>
+ <p><img src="PerformanceGraph.png?nopeers=" id="graph" alt="PerformanceGraph"/></p>
+ <form id="optionreloadGraph" action="" method="get"><p><input type="checkbox" name="option" id="autoreload" #(autoreload.checked)#::checked="checked"#(/autoreload.checked)#/> <label for="autoreload">refresh graph</label></p></form>
<form action="PerformanceMemory_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<p><input type="checkbox" name="simulatedshortmemory" onclick = 'this.form.submit()' #(simulatedshortmemory.checked)#:: checked="checked"#(/simulatedshortmemory.checked)#/>simulate short memory status</label></p>
<p><input type="checkbox" name="useStandardmemoryStrategy" onclick = 'this.form.submit()' #(useStandardmemoryStrategy.checked)#:: checked="checked"#(/useStandardmemoryStrategy.checked)#/>use Standard Memory Strategy (current: #[memoryStrategy]#)</p>
diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.java
index b6bf86f8a..11c1ed259 100644
--- a/htroot/PerformanceMemory_p.java
+++ b/htroot/PerformanceMemory_p.java
@@ -49,7 +49,7 @@ public class PerformanceMemory_p {
private static final long KB = 1024;
private static final long MB = 1024 * KB;
private static Map<String, String> defaultSettings = null;
-
+
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
@@ -58,18 +58,22 @@ public class PerformanceMemory_p {
}
prop.put("gc", "0");
+ prop.put("autoreload.checked", "0");
if (post != null) {
if (post.containsKey("gc")) {
System.gc();
prop.put("gc", "1");
+ prop.put("autoreload.checked", "1");
} else {
- MemoryControl.setSimulatedShortStatus(post.containsKey("simulatedshortmemory"));
+ boolean simulatedshortmemory = post.containsKey("simulatedshortmemory");
+ MemoryControl.setSimulatedShortStatus(simulatedshortmemory);
+ if (simulatedshortmemory) prop.put("autoreload.checked", "1");
final boolean std = post.containsKey("useStandardmemoryStrategy");
env.setConfig("memory.standardStrategy", std);
MemoryControl.setStandardStrategy(std);
}
}
-
+
prop.put("simulatedshortmemory.checked", MemoryControl.getSimulatedShortStatus() ? 1 : 0);
prop.put("useStandardmemoryStrategy.checked", env.getConfigBool("memory.standardStrategy", true) ? 1 : 0);
prop.put("memoryStrategy", MemoryControl.getStrategyName());
diff --git a/htroot/Performance_p.html b/htroot/Performance_p.html
index 8796d6680..e23df55bc 100644
--- a/htroot/Performance_p.html
+++ b/htroot/Performance_p.html
@@ -9,7 +9,7 @@
<script type="text/javascript"><!--
function reloadGraph() {
if(document.forms["optionreloadGraph"].option.checked)
- document.images["graph"].src="PerformanceGraph.png?time="+(new Date()).getTime();
+ document.images["graph"].src="PerformanceGraph.png?nopeers=&time="+(new Date()).getTime();
window.status="";
}
window.setInterval("reloadGraph()", 1000);
@@ -18,7 +18,7 @@
#%env/templates/submenuConfig.template%#
<h2>Performance Settings</h2>
- <p><img src="PerformanceGraph.png" id="graph" alt="PerformanceGraph" width="660" height="240"/></p>
+ <p><img src="PerformanceGraph.png?nopeers=" id="graph" alt="PerformanceGraph" width="660" height="240"/></p>
<form id="optionreloadGraph" action="" method="get"><p><input type="checkbox" name="option" id="autoreload"/> <label for="autoreload">refresh graph</label></p></form>
diff --git a/source/net/yacy/peers/graphics/ProfilingGraph.java b/source/net/yacy/peers/graphics/ProfilingGraph.java
index 7a7dfa116..6e02f099f 100644
--- a/source/net/yacy/peers/graphics/ProfilingGraph.java
+++ b/source/net/yacy/peers/graphics/ProfilingGraph.java
@@ -55,7 +55,7 @@ public class ProfilingGraph {
return max;
}
- public static RasterPlotter performanceGraph(final int width, final int height, final String subline, final boolean showMemory) {
+ public static RasterPlotter performanceGraph(final int width, final int height, final String subline, final boolean showMemory, final boolean showPeers) {
// find maximum values for automatic graph dimension adoption
final int maxppm = (int) maxPayload(EventTracker.EClass.PPM, 25);
final int maxwords = (int) maxPayload(EventTracker.EClass.WORDCACHE, 12000);
@@ -171,22 +171,24 @@ public class ProfilingGraph {
}
// draw peer ping
- events = EventTracker.getHistory(EventTracker.EClass.PEERPING);
- x0 = 1; y0 = 0;
- if (events != null) {
- EventTracker.Event event;
- EventPing ping;
- String pingPeer;
- while (events.hasNext()) {
- event = events.next();
- time = event.time - now;
- ping = (EventPing) event.payload;
- x1 = (int) (time/1000);
- y1 = Math.abs((ping.outgoing ? ping.toPeer : ping.fromPeer).hashCode()) % vspace;
- pingPeer = ping.outgoing ? "-> " + ping.toPeer.toUpperCase() : "<- " + ping.fromPeer.toUpperCase();
- chart.setColor(Long.parseLong("444444", 16));
- chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT2, x1, y1, 2, pingPeer + (ping.newPeers > 0 ? "(+" + ping.newPeers + ")" : ""), 0);
- x0 = x1; y0 = y1;
+ if (showPeers) {
+ events = EventTracker.getHistory(EventTracker.EClass.PEERPING);
+ x0 = 1; y0 = 0;
+ if (events != null) {
+ EventTracker.Event event;
+ EventPing ping;
+ String pingPeer;
+ while (events.hasNext()) {
+ event = events.next();
+ time = event.time - now;
+ ping = (EventPing) event.payload;
+ x1 = (int) (time/1000);
+ y1 = Math.abs((ping.outgoing ? ping.toPeer : ping.fromPeer).hashCode()) % vspace;
+ pingPeer = ping.outgoing ? "-> " + ping.toPeer.toUpperCase() : "<- " + ping.fromPeer.toUpperCase();
+ chart.setColor(Long.parseLong("9999AA", 16));
+ chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT2, x1, y1, 2, pingPeer + (ping.newPeers > 0 ? "(+" + ping.newPeers + ")" : ""), 0);
+ x0 = x1; y0 = y1;
+ }
}
}