1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Fix related to 180164, chunk-cache size was fixed to 5mb

This commit is contained in:
Markus Schorn 2007-03-30 12:41:31 +00:00
parent e0a8b09f75
commit 911c189dfb
2 changed files with 16 additions and 3 deletions

View file

@ -100,6 +100,13 @@ public final class ChunkCache {
}
}
/**
* Returns the maximum size of the chunk cache in bytes.
*/
public synchronized long getMaxSize() {
return (long) fPageTable.length * Database.CHUNK_SIZE;
}
/**
* Clears the page table and changes it to hold chunks with
* maximum total memory of <code>maxSize</code>.
@ -113,6 +120,7 @@ public final class ChunkCache {
System.arraycopy(fPageTable, 0, newTable, 0, oldLength);
fTableIsFull= false;
fPointer= oldLength;
fPageTable= newTable;
}
else {
for (int i=newLength; i<oldLength; i++) {
@ -124,6 +132,7 @@ public final class ChunkCache {
System.arraycopy(fPageTable, 0, newTable, 0, newLength);
fTableIsFull= true;
fPointer= 0;
fPageTable= newTable;
}
}

View file

@ -36,6 +36,7 @@ import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
import org.eclipse.cdt.internal.core.index.IWritableIndex;
import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
import org.eclipse.cdt.internal.core.pdom.PDOMWriter;
import org.eclipse.cdt.internal.core.pdom.db.ChunkCache;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@ -307,9 +308,12 @@ public abstract class PDOMIndexerTask extends PDOMWriter implements IPDOMIndexer
long hits= index.getCacheHits();
long tries= misses+hits;
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
System.out.println(name + " Cache: " //$NON-NLS-1$
+ hits + " hits, " //$NON-NLS-1$
+ misses + "(" + nf.format(missPct)+ ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
nf.setMinimumFractionDigits(4);
nf.setMaximumFractionDigits(4);
System.out.println(name + " Cache[" //$NON-NLS-1$
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "mb]: " + //$NON-NLS-1$
+ hits + " hits, " //$NON-NLS-1$
+ misses + "(" + nf.format(missPct)+ ") misses."); //$NON-NLS-1$//$NON-NLS-2$
}
}
}