mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Fix related to 180164, chunk-cache size was fixed to 5mb
This commit is contained in:
parent
e0a8b09f75
commit
911c189dfb
2 changed files with 16 additions and 3 deletions
|
@ -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
|
* Clears the page table and changes it to hold chunks with
|
||||||
* maximum total memory of <code>maxSize</code>.
|
* maximum total memory of <code>maxSize</code>.
|
||||||
|
@ -113,6 +120,7 @@ public final class ChunkCache {
|
||||||
System.arraycopy(fPageTable, 0, newTable, 0, oldLength);
|
System.arraycopy(fPageTable, 0, newTable, 0, oldLength);
|
||||||
fTableIsFull= false;
|
fTableIsFull= false;
|
||||||
fPointer= oldLength;
|
fPointer= oldLength;
|
||||||
|
fPageTable= newTable;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (int i=newLength; i<oldLength; i++) {
|
for (int i=newLength; i<oldLength; i++) {
|
||||||
|
@ -124,6 +132,7 @@ public final class ChunkCache {
|
||||||
System.arraycopy(fPageTable, 0, newTable, 0, newLength);
|
System.arraycopy(fPageTable, 0, newTable, 0, newLength);
|
||||||
fTableIsFull= true;
|
fTableIsFull= true;
|
||||||
fPointer= 0;
|
fPointer= 0;
|
||||||
|
fPageTable= newTable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.index.IWritableIndex;
|
||||||
import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
|
import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
|
||||||
import org.eclipse.cdt.internal.core.pdom.PDOMWriter;
|
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.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -307,9 +308,12 @@ public abstract class PDOMIndexerTask extends PDOMWriter implements IPDOMIndexer
|
||||||
long hits= index.getCacheHits();
|
long hits= index.getCacheHits();
|
||||||
long tries= misses+hits;
|
long tries= misses+hits;
|
||||||
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
|
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
|
||||||
System.out.println(name + " Cache: " //$NON-NLS-1$
|
nf.setMinimumFractionDigits(4);
|
||||||
+ hits + " hits, " //$NON-NLS-1$
|
nf.setMaximumFractionDigits(4);
|
||||||
+ misses + "(" + nf.format(missPct)+ ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue