Skip to content

Commit

Permalink
*)fixed bug in PerformanceMemory_p.java which caused negative memory-…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
auron_x committed May 14, 2006
1 parent ddfe0f0 commit 53d9ab6
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 54 deletions.
4 changes: 2 additions & 2 deletions htroot/PerformanceMemory_p.java
Expand Up @@ -63,9 +63,9 @@ public class PerformanceMemory_p {
private static final int MB = 1024 * KB;
private static Map defaultSettings = null;

private static int[] slt,chk;
private static long[] slt,chk;
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;

Expand Down
11 changes: 6 additions & 5 deletions source/de/anomic/data/blogBoard.java
Expand Up @@ -38,7 +38,8 @@
// the intact and unchanged copyright notice.
// 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;

Expand Down Expand Up @@ -85,11 +86,11 @@ public int size() {
return datbase.size();
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return datbase.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return datbase.cacheNodeFillStatus();
}

Expand Down Expand Up @@ -139,9 +140,9 @@ record = new HashMap();
if(date == null) date = new GregorianCalendar(GMTTimeZone).getTime();
record.put("date", dateString(date));
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";
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 = "";
record.put("ip", ip);
if (page == null)
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/data/messageBoard.java
Expand Up @@ -86,11 +86,11 @@ public int size() {
return database.size();
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return database.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return database.cacheNodeFillStatus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/data/userDB.java
Expand Up @@ -91,11 +91,11 @@ public userDB(File userTableFile, int bufferkb) {
}
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return userTable.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return userTable.cacheNodeFillStatus();
}

Expand Down
16 changes: 8 additions & 8 deletions source/de/anomic/data/wikiBoard.java
Expand Up @@ -100,20 +100,20 @@ public int size() {
return datbase.size();
}

public int[] dbCacheNodeChunkSize() {
int[] db = datbase.cacheNodeChunkSize();
int[] bk = bkpbase.cacheNodeChunkSize();
int[] i = new int[3];
public long[] dbCacheNodeChunkSize() {
long[] db = datbase.cacheNodeChunkSize();
long[] bk = bkpbase.cacheNodeChunkSize();
long[] i = new long[3];
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_HIGH] = (db[kelondroRecords.CP_HIGH] + bk[kelondroRecords.CP_HIGH]) / 2;
return i;
}

public int[] dbCacheNodeFillStatus() {
int[] a = datbase.cacheNodeFillStatus();
int[] b = bkpbase.cacheNodeFillStatus();
return new int[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]};
public long[] dbCacheNodeFillStatus() {
long[] a = datbase.cacheNodeFillStatus();
long[] b = bkpbase.cacheNodeFillStatus();
return new long[]{a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]};
}

public String[] dbCacheObjectStatus() {
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/kelondro/kelondroMap.java
Expand Up @@ -133,11 +133,11 @@ public int keySize() {
return dyn.columnSize(0);
}

public int[] cacheNodeChunkSize() {
public long[] cacheNodeChunkSize() {
return dyn.cacheNodeChunkSize();
}

public int[] cacheNodeFillStatus() {
public long[] cacheNodeFillStatus() {
return dyn.cacheNodeFillStatus();
}

Expand Down
10 changes: 5 additions & 5 deletions source/de/anomic/kelondro/kelondroRecords.java
Expand Up @@ -456,21 +456,21 @@ protected final int cacheNodeChunkSize(boolean cacheControl) {
return this.headchunksize + element_in_cache + ((cacheControl) ? cache_control_entry : 0);
}

public int[] cacheNodeChunkSize() {
public long[] cacheNodeChunkSize() {
// returns three integers:
// #0: chunk size of CP_LOW - priority entries
// #1: chunk size of CP_MEDIUM - 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_MEDIUM] = cacheNodeChunkSize(false);
i[CP_HIGH] = cacheNodeChunkSize(this.cacheScore != null);
return i;
}

public int[] cacheNodeFillStatus() {
if (XcacheHeaders == null) return new int[]{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()};
public long[] cacheNodeFillStatus() {
if (XcacheHeaders == null) return new long[]{0,0,0,0};
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 {
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaCrawlProfile.java
Expand Up @@ -77,11 +77,11 @@ public plasmaCrawlProfile(File file, int bufferkb) {
domsCache = new HashMap();
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return profileTable.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return profileTable.cacheNodeFillStatus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaCrawlRobotsTxt.java
Expand Up @@ -85,11 +85,11 @@ public plasmaCrawlRobotsTxt(File robotsTableFile, int bufferkb) {
}
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return robotsTable.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return robotsTable.cacheNodeFillStatus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaHTCache.java
Expand Up @@ -201,11 +201,11 @@ public int dbSize() {
return this.responseHeaderDB.size();
}

public int[] dbCacheChunkSize() {
public long[] dbCacheChunkSize() {
return this.responseHeaderDB.cacheNodeChunkSize();
}

public int[] dbCacheFillStatus() {
public long[] dbCacheFillStatus() {
return this.responseHeaderDB.cacheNodeFillStatus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -125,11 +125,11 @@ public int[] assortmentsSizes() {
return assortmentCluster.sizes();
}

public int[] assortmentsCacheChunkSizeAvg() {
public long[] assortmentsCacheChunkSizeAvg() {
return assortmentCluster.cacheChunkSizeAvg();
}

public int[] assortmentsCacheFillStatusCml() {
public long[] assortmentsCacheFillStatusCml() {
return assortmentCluster.cacheFillStatusCml();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/plasma/plasmaWordIndexAssortment.java
Expand Up @@ -261,11 +261,11 @@ public int size() {
return assortments.size();
}

public int[] cacheNodeChunkSize() {
public long[] cacheNodeChunkSize() {
return assortments.cacheNodeChunkSize();
}

public int[] cacheNodeFillStatus() {
public long[] cacheNodeFillStatus() {
return assortments.cacheNodeFillStatus();
}

Expand Down
8 changes: 4 additions & 4 deletions source/de/anomic/plasma/plasmaWordIndexAssortmentCluster.java
Expand Up @@ -263,9 +263,9 @@ public int[] sizes() {
return sizes;
}

public int[] cacheChunkSizeAvg() {
public long[] cacheChunkSizeAvg() {
int[] i = new int[]{0, 0, 0};
int[] a = new int[3];
long[] a = new long[3];
for (int j = 0; j < clusterCount; j++) {
a = assortments[j].cacheNodeChunkSize();
i[kelondroRecords.CP_LOW] += a[kelondroRecords.CP_LOW];
Expand All @@ -278,8 +278,8 @@ public int[] cacheChunkSizeAvg() {
return a;
}

public int[] cacheFillStatusCml() {
int[] a, cml = new int[]{0, 0, 0, 0};
public long[] cacheFillStatusCml() {
long[] a, cml = new long[]{0, 0, 0, 0};
for (int i = 0; i < clusterCount; i++) {
a = assortments[i].cacheNodeFillStatus();
for (int j = 0; j < 4; j++) cml[j] += a[j];
Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/yacy/yacyNewsDB.java
Expand Up @@ -96,11 +96,11 @@ private void resetDB() {
news = createDB(path, bufferkb);
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return news.cacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return news.cacheNodeFillStatus();
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/yacy/yacyNewsPool.java
Expand Up @@ -106,11 +106,11 @@ public int dbSize() {
return newsDB.size();
}

public int[] dbCacheNodeChunkSize() {
public long[] dbCacheNodeChunkSize() {
return newsDB.dbCacheNodeChunkSize();
}

public int[] dbCacheNodeFillStatus() {
public long[] dbCacheNodeFillStatus() {
return newsDB.dbCacheNodeFillStatus();
}

Expand Down
20 changes: 10 additions & 10 deletions source/de/anomic/yacy/yacySeedDB.java
Expand Up @@ -170,22 +170,22 @@ public synchronized void removeMySeed() {
} catch (IOException e) {}
}

public int[] dbCacheNodeChunkSize() {
int[] ac = seedActiveDB.cacheNodeChunkSize();
int[] pa = seedPassiveDB.cacheNodeChunkSize();
int[] po = seedPotentialDB.cacheNodeChunkSize();
int[] i = new int[3];
public long[] dbCacheNodeChunkSize() {
long[] ac = seedActiveDB.cacheNodeChunkSize();
long[] pa = seedPassiveDB.cacheNodeChunkSize();
long[] po = seedPotentialDB.cacheNodeChunkSize();
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_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;
return i;
}

public int[] dbCacheNodeFillStatus() {
int[] ac = seedActiveDB.cacheNodeFillStatus();
int[] pa = seedPassiveDB.cacheNodeFillStatus();
int[] 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]};
public long[] dbCacheNodeFillStatus() {
long[] ac = seedActiveDB.cacheNodeFillStatus();
long[] pa = seedPassiveDB.cacheNodeFillStatus();
long[] po = seedPotentialDB.cacheNodeFillStatus();
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() {
Expand Down

0 comments on commit 53d9ab6

Please sign in to comment.