1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Early filtering of duplicate files.

This commit is contained in:
Sergey Prigogin 2010-01-19 00:01:42 +00:00
parent 82fc7b6d78
commit 52821a6191

View file

@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.core.pdom.indexer;
import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Map;
import com.ibm.icu.text.NumberFormat;
@ -66,8 +67,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE));
if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) {
setSkipReferences(SKIP_ALL_REFERENCES);
}
else {
} else {
int skipRefs= 0;
if (checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES)) {
skipRefs |= SKIP_IMPLICIT_REFERENCES;
@ -102,17 +102,20 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
}
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
ITranslationUnit[] result= new ITranslationUnit[added.length+changed.length];
System.arraycopy(added, 0, result, 0, added.length);
System.arraycopy(changed, 0, result, added.length, changed.length);
return result;
LinkedHashSet<ITranslationUnit> union = new LinkedHashSet<ITranslationUnit>(added.length + changed.length);
for (ITranslationUnit tu : added) {
union.add(tu);
}
for (ITranslationUnit tu : changed) {
union.add(tu);
}
return union.toArray(new ITranslationUnit[union.size()]);
}
public final void setParseUpFront() {
setParseUpFront(fIndexer.getFilesToParseUpFront());
}
public final IPDOMIndexer getIndexer() {
return fIndexer;
}
@ -138,7 +141,6 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
return TRUE.equals(getIndexer().getProperty(key));
}
@Override
protected String getASTPathForParsingUpFront() {
final IProject project = getProject().getProject();
@ -294,7 +296,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
long tries= misses + hits;
double missPct= tries == 0 ? 0.0 : (double) misses / (double) tries;
System.out.println(ident + " Cache[" //$NON-NLS-1$
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "mb]: " + //$NON-NLS-1$
+ ChunkCache.getSharedInstance().getMaxSize() / 1024 / 1024 + "MB]: " + //$NON-NLS-1$
+ hits + " hits, " //$NON-NLS-1$
+ misses + "(" + nfPercent.format(missPct) + ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
@ -308,7 +310,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
final String sep0 = "|"; //$NON-NLS-1$
final String sep = "| "; //$NON-NLS-1$
final String sec = "s"; //$NON-NLS-1$
final String mb = "mb"; //$NON-NLS-1$
final String mb = "MB"; //$NON-NLS-1$
final String million = "M"; //$NON-NLS-1$
System.out.print(sep0);
System.out.print(cal.get(Calendar.YEAR) + twoDigits.format(cal.get(Calendar.MONTH) + 1) + twoDigits.format(cal.get(Calendar.DAY_OF_MONTH)));