Skip to content

Commit

Permalink
some correction algorithm for preload time computation during assortm…
Browse files Browse the repository at this point in the history
…ent open

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2279 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 5, 2006
1 parent e22cbae commit b0ca5fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions source/de/anomic/plasma/plasmaWordIndexAssortment.java
Expand Up @@ -114,12 +114,15 @@ public plasmaWordIndexAssortment(File storagePath, int assortmentLength, int buf
if (assortmentFile.exists()) {
// open existing assortment tree file
try {
long start = System.currentTimeMillis();
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent);
long stop = System.currentTimeMillis();
if (log != null)
log.logConfig("Opened Assortment Database, " +
log.logConfig("Opened Assortment, " +
assortments.size() + " entries, width " +
assortmentLength + ", " + bufferkb + "kb buffer, " +
preloadTime + " ms preloadTime, " +
(stop - start) + " ms effective, " +
assortments.cacheNodeStatus()[1] + " preloaded");
return;
} catch (IOException e){
Expand All @@ -131,7 +134,7 @@ public plasmaWordIndexAssortment(File storagePath, int assortmentLength, int buf
}
// create new assortment tree file
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent, new kelondroRow(bufferStructure(assortmentLength)), true);
if (log != null) log.logConfig("Created new Assortment Database, width " + assortmentLength + ", " + bufferkb + "kb buffer");
if (log != null) log.logConfig("Created new Assortment, width " + assortmentLength + ", " + bufferkb + "kb buffer");
}

public void store(indexContainer newContainer) {
Expand Down
Expand Up @@ -95,12 +95,19 @@ public plasmaWordIndexAssortmentCluster(File assortmentsPath, int clusterCount,

// initialize cluster using the cluster elements size for optimal buffer
// size
long nextTime;
long startTime;
long sS = (long) sumSizes;
for (int i = 0; i < clusterCount; i++) {
nextTime = Math.max(0, preloadTime * ((long) sizes[i]) / sS);
startTime = System.currentTimeMillis();
assortments[i] = new plasmaWordIndexAssortment(
assortmentsPath, i + 1,
(int) (completeBufferKB * (long) sizes[i] / (long) sumSizes),
preloadTime * (long) sizes[i] / (long) sumSizes,
nextTime,
log);
preloadTime -= System.currentTimeMillis() - startTime;
sS -= sizes[i];
}
}

Expand Down

0 comments on commit b0ca5fa

Please sign in to comment.