some correction algorithm for preload time computation during assortment open

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2279 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent e22cbaee97
commit b0ca5fa784

@ -114,12 +114,15 @@ public final class plasmaWordIndexAssortment {
if (assortmentFile.exists()) { if (assortmentFile.exists()) {
// open existing assortment tree file // open existing assortment tree file
try { try {
long start = System.currentTimeMillis();
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent); assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent);
long stop = System.currentTimeMillis();
if (log != null) if (log != null)
log.logConfig("Opened Assortment Database, " + log.logConfig("Opened Assortment, " +
assortments.size() + " entries, width " + assortments.size() + " entries, width " +
assortmentLength + ", " + bufferkb + "kb buffer, " + assortmentLength + ", " + bufferkb + "kb buffer, " +
preloadTime + " ms preloadTime, " + preloadTime + " ms preloadTime, " +
(stop - start) + " ms effective, " +
assortments.cacheNodeStatus()[1] + " preloaded"); assortments.cacheNodeStatus()[1] + " preloaded");
return; return;
} catch (IOException e){ } catch (IOException e){
@ -131,7 +134,7 @@ public final class plasmaWordIndexAssortment {
} }
// create new assortment tree file // create new assortment tree file
assortments = new kelondroTree(assortmentFile, bufferSize, preloadTime, kelondroTree.defaultObjectCachePercent, new kelondroRow(bufferStructure(assortmentLength)), true); 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) { public void store(indexContainer newContainer) {

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

Loading…
Cancel
Save