Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) displaying amount of items in the existsIndex caches
thelif95d98142ffb
diff --git a/htroot/PerformanceMemory_p.html b/htroot/PerformanceMemory_p.htmlindex f4d028327..5437fdead 100644--- a/htroot/PerformanceMemory_p.html+++ b/htroot/PerformanceMemory_p.html@@ -336,6 +336,32 @@ Increasing this cache may speed up crawling, but not much space is needed, so th</table></p>+<!-- other cache sizes -->+<div class=small><b>Other caching structures:</b></div>+ <table border="0" cellpadding="2" cellspacing="1">+ <tr class="TableHeader" valign="bottom">+ <td class="small">Type</td>+ <td class="small">Amount</td>+ <td class="small">Size</td>+ </tr>+ <tr class="TableCellDark">+ <td class="small">EURL existsIndex</td>+ <td class="small">#[eurl.existsIndexAmount]#</td>+ <td class="small">#[eurl.existsIndexSize]#</td>+ </tr>+ <tr class="TableCellLight">+ <td class="small">NURL existsIndex</td>+ <td class="small">#[nurl.existsIndexAmount]#</td>+ <td class="small">#[nurl.existsIndexSize]#</td>+ </tr>+ <tr class="TableCellDark">+ <td class="small">LURL existsIndex</td>+ <td class="small">#[lurl.existsIndexAmount]#</td>+ <td class="small">#[lurl.existsIndexSize]#</td>+ </tr>+ </table>+</p>+#%env/templates/footer.template%#</body></html>diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.javaindex 1c0e18e46..b03a73534 100644--- a/htroot/PerformanceMemory_p.java+++ b/htroot/PerformanceMemory_p.java@@ -49,6 +49,8 @@ import java.io.File;import de.anomic.http.httpHeader;import de.anomic.plasma.plasmaSwitchboard;+import de.anomic.plasma.plasmaURL;+import de.anomic.server.serverMemory;import de.anomic.server.serverObjects;import de.anomic.server.serverSwitch;import de.anomic.server.serverFileUtils;@@ -251,6 +253,17 @@ public class PerformanceMemory_p {prop.put("alive", Integer.toString(c));prop.put("heap" , Integer.toString(c));+ // other caching structures+ long amount = sb.urlPool.errorURL.existsIndexSize();+ prop.put("eurl.existsIndexAmount",Long.toString(amount));+ prop.put("eurl.existsIndexSize",serverMemory.bytesToString(amount*plasmaURL.urlHashLength));+ amount = sb.urlPool.noticeURL.existsIndexSize();+ prop.put("nurl.existsIndexAmount",Long.toString(amount));+ prop.put("nurl.existsIndexSize",serverMemory.bytesToString(amount*plasmaURL.urlHashLength));+ amount = sb.urlPool.loadedURL.existsIndexSize();+ prop.put("lurl.existsIndexAmount",Long.toString(amount));+ prop.put("lurl.existsIndexSize",serverMemory.bytesToString(amount*plasmaURL.urlHashLength));+// return rewrite values for templatesreturn prop;}diff --git a/source/de/anomic/plasma/plasmaURL.java b/source/de/anomic/plasma/plasmaURL.javaindex 650d47d9d..2d0c1e7cb 100644--- a/source/de/anomic/plasma/plasmaURL.java+++ b/source/de/anomic/plasma/plasmaURL.java@@ -424,7 +424,7 @@ public class plasmaURL {// the class objectpublic kelondroTree urlHashCache;- private HashSet existsIndex;+ private final HashSet existsIndex;public plasmaURL() {urlHashCache = null;@@ -454,6 +454,10 @@ public class plasmaURL {}}}++ public long existsIndexSize() {+ return this.existsIndex.size();+ }public boolean remove(String urlHash) {synchronized (existsIndex) {diff --git a/source/de/anomic/server/serverMemory.java b/source/de/anomic/server/serverMemory.javaindex 623348d43..ab33cdfa1 100644--- a/source/de/anomic/server/serverMemory.java+++ b/source/de/anomic/server/serverMemory.java@@ -45,6 +45,8 @@package de.anomic.server;+import java.text.DecimalFormat;+public class serverMemory {public static final long max = Runtime.getRuntime().maxMemory();@@ -65,4 +67,28 @@ public class serverMemory {return runtime.totalMemory() - runtime.freeMemory();}+ public static String bytesToString(long byteCount) {+ try {+ final StringBuffer byteString = new StringBuffer();++ final DecimalFormat df = new DecimalFormat( "0.00" );+ if (byteCount > 1073741824) {+ byteString.append(df.format((double)byteCount / (double)1073741824 ))+ .append(" GB");+ } else if (byteCount > 1048576) {+ byteString.append(df.format((double)byteCount / (double)1048576))+ .append(" MB");+ } else if (byteCount > 1024) {+ byteString.append(df.format((double)byteCount / (double)1024))+ .append(" KB");+ } else {+ byteString.append(Long.toString(byteCount))+ .append(" Bytes");+ }++ return byteString.toString();+ } catch (Exception e) {+ return "unknown";+ }+ }}