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:
parent
82fc7b6d78
commit
52821a6191
1 changed files with 28 additions and 26 deletions
|
@ -12,6 +12,7 @@
|
||||||
package org.eclipse.cdt.internal.core.pdom.indexer;
|
package org.eclipse.cdt.internal.core.pdom.indexer;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ibm.icu.text.NumberFormat;
|
import com.ibm.icu.text.NumberFormat;
|
||||||
|
@ -66,8 +67,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE));
|
setShowProblems(checkDebugOption(TRACE_PROBLEMS, TRUE));
|
||||||
if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) {
|
if (checkProperty(IndexerPreferences.KEY_SKIP_ALL_REFERENCES)) {
|
||||||
setSkipReferences(SKIP_ALL_REFERENCES);
|
setSkipReferences(SKIP_ALL_REFERENCES);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int skipRefs= 0;
|
int skipRefs= 0;
|
||||||
if (checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES)) {
|
if (checkProperty(IndexerPreferences.KEY_SKIP_IMPLICIT_REFERENCES)) {
|
||||||
skipRefs |= 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) {
|
private static ITranslationUnit[] concat(ITranslationUnit[] added, ITranslationUnit[] changed) {
|
||||||
ITranslationUnit[] result= new ITranslationUnit[added.length+changed.length];
|
LinkedHashSet<ITranslationUnit> union = new LinkedHashSet<ITranslationUnit>(added.length + changed.length);
|
||||||
System.arraycopy(added, 0, result, 0, added.length);
|
for (ITranslationUnit tu : added) {
|
||||||
System.arraycopy(changed, 0, result, added.length, changed.length);
|
union.add(tu);
|
||||||
return result;
|
}
|
||||||
|
for (ITranslationUnit tu : changed) {
|
||||||
|
union.add(tu);
|
||||||
|
}
|
||||||
|
return union.toArray(new ITranslationUnit[union.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setParseUpFront() {
|
public final void setParseUpFront() {
|
||||||
setParseUpFront(fIndexer.getFilesToParseUpFront());
|
setParseUpFront(fIndexer.getFilesToParseUpFront());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final IPDOMIndexer getIndexer() {
|
public final IPDOMIndexer getIndexer() {
|
||||||
return fIndexer;
|
return fIndexer;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +141,6 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return TRUE.equals(getIndexer().getProperty(key));
|
return TRUE.equals(getIndexer().getProperty(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getASTPathForParsingUpFront() {
|
protected String getASTPathForParsingUpFront() {
|
||||||
final IProject project = getProject().getProject();
|
final IProject project = getProject().getProject();
|
||||||
|
@ -294,7 +296,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
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(ident + " Cache[" //$NON-NLS-1$
|
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$
|
+ hits + " hits, " //$NON-NLS-1$
|
||||||
+ misses + "(" + nfPercent.format(missPct) + ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ 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 sep0 = "|"; //$NON-NLS-1$
|
||||||
final String sep = "| "; //$NON-NLS-1$
|
final String sep = "| "; //$NON-NLS-1$
|
||||||
final String sec = "s"; //$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$
|
final String million = "M"; //$NON-NLS-1$
|
||||||
System.out.print(sep0);
|
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)));
|
System.out.print(cal.get(Calendar.YEAR) + twoDigits.format(cal.get(Calendar.MONTH) + 1) + twoDigits.format(cal.get(Calendar.DAY_OF_MONTH)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue