diff --git a/htroot/PerformanceMemory_p.html b/htroot/PerformanceMemory_p.html index 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

+ +
Other caching structures:
+ + + + + + + + + + + + + + + + + + + + + +
TypeAmountSize
EURL existsIndex#[eurl.existsIndexAmount]##[eurl.existsIndexSize]#
NURL existsIndex#[nurl.existsIndexAmount]##[nurl.existsIndexSize]#
LURL existsIndex#[lurl.existsIndexAmount]##[lurl.existsIndexSize]#
+

+ #%env/templates/footer.template%# diff --git a/htroot/PerformanceMemory_p.java b/htroot/PerformanceMemory_p.java index 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 templates return prop; } diff --git a/source/de/anomic/plasma/plasmaURL.java b/source/de/anomic/plasma/plasmaURL.java index 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 object public 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.java index 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"; + } + } }