*) displaying amount of items in the existsIndex caches

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1679 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 9b941fb773
commit f95d98142f

@ -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>

@ -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;
}

@ -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) {

@ -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";
}
}
}

Loading…
Cancel
Save