*)fixed bug in PerformanceMemory_p.java which caused negative memory-values on big peers

see http://www.yacy-forum.de/viewtopic.php?t=2370

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2091 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
auron_x 19 years ago
parent ddfe0f0e27
commit 53d9ab6db7

@ -63,9 +63,9 @@ public class PerformanceMemory_p {
private static final int MB = 1024 * KB; private static final int MB = 1024 * KB;
private static Map defaultSettings = null; private static Map defaultSettings = null;
private static int[] slt,chk; private static long[] slt,chk;
private static String[] ost; private static String[] ost;
private static int req, usd, bst, god; private static long req, usd, bst, god;
private static long usedTotal, currTotal, dfltTotal, goodTotal, bestTotal; private static long usedTotal, currTotal, dfltTotal, goodTotal, bestTotal;

@ -38,7 +38,8 @@
// the intact and unchanged copyright notice. // the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such. // Contributions and changes to the program code must be marked as such.
// Contains contributions from Jan Sandbrink [JS] // This file is contributed by Jan Sandbrink
// based on the Code of wikiBoard.java
package de.anomic.data; package de.anomic.data;
@ -85,11 +86,11 @@ public class blogBoard {
return datbase.size(); return datbase.size();
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return datbase.cacheNodeChunkSize(); return datbase.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return datbase.cacheNodeFillStatus(); return datbase.cacheNodeFillStatus();
} }
@ -139,9 +140,9 @@ public class blogBoard {
if(date == null) date = new GregorianCalendar(GMTTimeZone).getTime(); if(date == null) date = new GregorianCalendar(GMTTimeZone).getTime();
record.put("date", dateString(date)); record.put("date", dateString(date));
if ((subject == null) || (subject.length() == 0)) subject = ""; if ((subject == null) || (subject.length() == 0)) subject = "";
record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject.getBytes())); record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject.getBytes("UTF-8")));
if ((author == null) || (author.length() == 0)) author = "anonymous"; if ((author == null) || (author.length() == 0)) author = "anonymous";
record.put("author", kelondroBase64Order.enhancedCoder.encode(author.getBytes())); record.put("author", kelondroBase64Order.enhancedCoder.encode(author.getBytes("UTF-8")));
if ((ip == null) || (ip.length() == 0)) ip = ""; if ((ip == null) || (ip.length() == 0)) ip = "";
record.put("ip", ip); record.put("ip", ip);
if (page == null) if (page == null)

@ -86,11 +86,11 @@ public class messageBoard {
return database.size(); return database.size();
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return database.cacheNodeChunkSize(); return database.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return database.cacheNodeFillStatus(); return database.cacheNodeFillStatus();
} }

@ -91,11 +91,11 @@ public final class userDB {
} }
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return userTable.cacheNodeChunkSize(); return userTable.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return userTable.cacheNodeFillStatus(); return userTable.cacheNodeFillStatus();
} }

@ -100,20 +100,20 @@ public class wikiBoard {
return datbase.size(); return datbase.size();
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
int[] db = datbase.cacheNodeChunkSize(); long[] db = datbase.cacheNodeChunkSize();
int[] bk = bkpbase.cacheNodeChunkSize(); long[] bk = bkpbase.cacheNodeChunkSize();
int[] i = new int[3]; long[] i = new long[3];
i[kelondroRecords.CP_LOW] = (db[kelondroRecords.CP_LOW] + bk[kelondroRecords.CP_LOW]) / 2; i[kelondroRecords.CP_LOW] = (db[kelondroRecords.CP_LOW] + bk[kelondroRecords.CP_LOW]) / 2;
i[kelondroRecords.CP_MEDIUM] = (db[kelondroRecords.CP_MEDIUM] + bk[kelondroRecords.CP_MEDIUM]) / 2; i[kelondroRecords.CP_MEDIUM] = (db[kelondroRecords.CP_MEDIUM] + bk[kelondroRecords.CP_MEDIUM]) / 2;
i[kelondroRecords.CP_HIGH] = (db[kelondroRecords.CP_HIGH] + bk[kelondroRecords.CP_HIGH]) / 2; i[kelondroRecords.CP_HIGH] = (db[kelondroRecords.CP_HIGH] + bk[kelondroRecords.CP_HIGH]) / 2;
return i; return i;
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
int[] a = datbase.cacheNodeFillStatus(); long[] a = datbase.cacheNodeFillStatus();
int[] b = bkpbase.cacheNodeFillStatus(); long[] b = bkpbase.cacheNodeFillStatus();
return new int[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]}; return new long[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]};
} }
public String[] dbCacheObjectStatus() { public String[] dbCacheObjectStatus() {

@ -133,11 +133,11 @@ public class kelondroMap {
return dyn.columnSize(0); return dyn.columnSize(0);
} }
public int[] cacheNodeChunkSize() { public long[] cacheNodeChunkSize() {
return dyn.cacheNodeChunkSize(); return dyn.cacheNodeChunkSize();
} }
public int[] cacheNodeFillStatus() { public long[] cacheNodeFillStatus() {
return dyn.cacheNodeFillStatus(); return dyn.cacheNodeFillStatus();
} }

@ -456,21 +456,21 @@ public class kelondroRecords {
return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0); return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0);
} }
public int[] cacheNodeChunkSize() { public long[] cacheNodeChunkSize() {
// returns three integers: // returns three integers:
// #0: chunk size of CP_LOW - priority entries // #0: chunk size of CP_LOW - priority entries
// #1: chunk size of CP_MEDIUM - priority entries // #1: chunk size of CP_MEDIUM - priority entries
// #2: chunk size of CP_HIGH - priority entries // #2: chunk size of CP_HIGH - priority entries
int[] i = new int[3]; long[] i = new long[3];
i[CP_LOW] = cacheNodeChunkSize(false); i[CP_LOW] = cacheNodeChunkSize(false);
i[CP_MEDIUM] = cacheNodeChunkSize(false); i[CP_MEDIUM] = cacheNodeChunkSize(false);
i[CP_HIGH] = cacheNodeChunkSize(this.cacheScore != null); i[CP_HIGH] = cacheNodeChunkSize(this.cacheScore != null);
return i; return i;
} }
public int[] cacheNodeFillStatus() { public long[] cacheNodeFillStatus() {
if (XcacheHeaders == null) return new int[]{0,0,0,0}; if (XcacheHeaders == null) return new long[]{0,0,0,0};
return new int[]{XcacheSize - (XcacheHeaders[CP_HIGH].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_LOW].size()), XcacheHeaders[CP_HIGH].size(), XcacheHeaders[CP_MEDIUM].size(), XcacheHeaders[CP_LOW].size()}; return new long[]{XcacheSize - (XcacheHeaders[CP_HIGH].size() + XcacheHeaders[CP_MEDIUM].size() + XcacheHeaders[CP_LOW].size()), XcacheHeaders[CP_HIGH].size(), XcacheHeaders[CP_MEDIUM].size(), XcacheHeaders[CP_LOW].size()};
} }
protected Node newNode() throws IOException { protected Node newNode() throws IOException {

@ -77,11 +77,11 @@ public class plasmaCrawlProfile {
domsCache = new HashMap(); domsCache = new HashMap();
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return profileTable.cacheNodeChunkSize(); return profileTable.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return profileTable.cacheNodeFillStatus(); return profileTable.cacheNodeFillStatus();
} }

@ -85,11 +85,11 @@ public class plasmaCrawlRobotsTxt {
} }
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return robotsTable.cacheNodeChunkSize(); return robotsTable.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return robotsTable.cacheNodeFillStatus(); return robotsTable.cacheNodeFillStatus();
} }

@ -201,11 +201,11 @@ public final class plasmaHTCache {
return this.responseHeaderDB.size(); return this.responseHeaderDB.size();
} }
public int[] dbCacheChunkSize() { public long[] dbCacheChunkSize() {
return this.responseHeaderDB.cacheNodeChunkSize(); return this.responseHeaderDB.cacheNodeChunkSize();
} }
public int[] dbCacheFillStatus() { public long[] dbCacheFillStatus() {
return this.responseHeaderDB.cacheNodeFillStatus(); return this.responseHeaderDB.cacheNodeFillStatus();
} }

@ -125,11 +125,11 @@ public final class plasmaWordIndex {
return assortmentCluster.sizes(); return assortmentCluster.sizes();
} }
public int[] assortmentsCacheChunkSizeAvg() { public long[] assortmentsCacheChunkSizeAvg() {
return assortmentCluster.cacheChunkSizeAvg(); return assortmentCluster.cacheChunkSizeAvg();
} }
public int[] assortmentsCacheFillStatusCml() { public long[] assortmentsCacheFillStatusCml() {
return assortmentCluster.cacheFillStatusCml(); return assortmentCluster.cacheFillStatusCml();
} }

@ -261,11 +261,11 @@ public final class plasmaWordIndexAssortment {
return assortments.size(); return assortments.size();
} }
public int[] cacheNodeChunkSize() { public long[] cacheNodeChunkSize() {
return assortments.cacheNodeChunkSize(); return assortments.cacheNodeChunkSize();
} }
public int[] cacheNodeFillStatus() { public long[] cacheNodeFillStatus() {
return assortments.cacheNodeFillStatus(); return assortments.cacheNodeFillStatus();
} }

@ -263,9 +263,9 @@ public final class plasmaWordIndexAssortmentCluster {
return sizes; return sizes;
} }
public int[] cacheChunkSizeAvg() { public long[] cacheChunkSizeAvg() {
int[] i = new int[]{0, 0, 0}; int[] i = new int[]{0, 0, 0};
int[] a = new int[3]; long[] a = new long[3];
for (int j = 0; j < clusterCount; j++) { for (int j = 0; j < clusterCount; j++) {
a = assortments[j].cacheNodeChunkSize(); a = assortments[j].cacheNodeChunkSize();
i[kelondroRecords.CP_LOW] += a[kelondroRecords.CP_LOW]; i[kelondroRecords.CP_LOW] += a[kelondroRecords.CP_LOW];
@ -278,8 +278,8 @@ public final class plasmaWordIndexAssortmentCluster {
return a; return a;
} }
public int[] cacheFillStatusCml() { public long[] cacheFillStatusCml() {
int[] a, cml = new int[]{0, 0, 0, 0}; long[] a, cml = new long[]{0, 0, 0, 0};
for (int i = 0; i < clusterCount; i++) { for (int i = 0; i < clusterCount; i++) {
a = assortments[i].cacheNodeFillStatus(); a = assortments[i].cacheNodeFillStatus();
for (int j = 0; j < 4; j++) cml[j] += a[j]; for (int j = 0; j < 4; j++) cml[j] += a[j];

@ -96,11 +96,11 @@ public class yacyNewsDB {
news = createDB(path, bufferkb); news = createDB(path, bufferkb);
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return news.cacheNodeChunkSize(); return news.cacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return news.cacheNodeFillStatus(); return news.cacheNodeFillStatus();
} }

@ -106,11 +106,11 @@ public class yacyNewsPool {
return newsDB.size(); return newsDB.size();
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
return newsDB.dbCacheNodeChunkSize(); return newsDB.dbCacheNodeChunkSize();
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
return newsDB.dbCacheNodeFillStatus(); return newsDB.dbCacheNodeFillStatus();
} }

@ -170,22 +170,22 @@ public final class yacySeedDB {
} catch (IOException e) {} } catch (IOException e) {}
} }
public int[] dbCacheNodeChunkSize() { public long[] dbCacheNodeChunkSize() {
int[] ac = seedActiveDB.cacheNodeChunkSize(); long[] ac = seedActiveDB.cacheNodeChunkSize();
int[] pa = seedPassiveDB.cacheNodeChunkSize(); long[] pa = seedPassiveDB.cacheNodeChunkSize();
int[] po = seedPotentialDB.cacheNodeChunkSize(); long[] po = seedPotentialDB.cacheNodeChunkSize();
int[] i = new int[3]; long[] i = new long[3];
i[kelondroRecords.CP_LOW] = (ac[kelondroRecords.CP_LOW] + pa[kelondroRecords.CP_LOW] + po[kelondroRecords.CP_LOW]) / 3; i[kelondroRecords.CP_LOW] = (ac[kelondroRecords.CP_LOW] + pa[kelondroRecords.CP_LOW] + po[kelondroRecords.CP_LOW]) / 3;
i[kelondroRecords.CP_MEDIUM] = (ac[kelondroRecords.CP_MEDIUM] + pa[kelondroRecords.CP_MEDIUM] + po[kelondroRecords.CP_MEDIUM]) / 3; i[kelondroRecords.CP_MEDIUM] = (ac[kelondroRecords.CP_MEDIUM] + pa[kelondroRecords.CP_MEDIUM] + po[kelondroRecords.CP_MEDIUM]) / 3;
i[kelondroRecords.CP_HIGH] = (ac[kelondroRecords.CP_HIGH] + pa[kelondroRecords.CP_HIGH] + po[kelondroRecords.CP_HIGH]) / 3; i[kelondroRecords.CP_HIGH] = (ac[kelondroRecords.CP_HIGH] + pa[kelondroRecords.CP_HIGH] + po[kelondroRecords.CP_HIGH]) / 3;
return i; return i;
} }
public int[] dbCacheNodeFillStatus() { public long[] dbCacheNodeFillStatus() {
int[] ac = seedActiveDB.cacheNodeFillStatus(); long[] ac = seedActiveDB.cacheNodeFillStatus();
int[] pa = seedPassiveDB.cacheNodeFillStatus(); long[] pa = seedPassiveDB.cacheNodeFillStatus();
int[] po = seedPotentialDB.cacheNodeFillStatus(); long[] po = seedPotentialDB.cacheNodeFillStatus();
return new int[]{ac[0] + pa[0] + po[0], ac[1] + pa[1] + po[1], ac[2] + pa[2] + po[2], ac[3] + pa[3] + po[3]}; return new long[]{ac[0] + pa[0] + po[0], ac[1] + pa[1] + po[1], ac[2] + pa[2] + po[2], ac[3] + pa[3] + po[3]};
} }
public String[] dbCacheObjectStatus() { public String[] dbCacheObjectStatus() {

Loading…
Cancel
Save