From 6f3df88cd1494ae0269d7914443c70a4a475db19 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 29 Nov 2006 08:52:21 +0000 Subject: [PATCH] Related to 155324, output statistics when tracing indexer. --- .../core/pdom/indexer/PDOMIndexerTask.java | 64 +++++++++++++++++-- .../indexer/fast/PDOMFastHandleDelta.java | 10 +-- .../pdom/indexer/fast/PDOMFastReindex.java | 10 +-- .../indexer/full/PDOMFullHandleDelta.java | 9 +-- .../pdom/indexer/full/PDOMFullReindex.java | 10 +-- 5 files changed, 65 insertions(+), 38 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java index d1da4ad501b..7a87c556d1a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/PDOMIndexerTask.java @@ -27,6 +27,8 @@ import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement; import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndexFile; import org.eclipse.cdt.core.index.IIndexInclude; @@ -54,16 +56,27 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask { protected volatile int fTotalSourcesEstimate= 0; protected volatile int fCompletedSources= 0; protected volatile int fCompletedHeaders= 0; - protected int fErrorCount; protected Map fContextMap= new HashMap(); protected volatile String fMessage; - protected boolean fTrace; + + private boolean fTrace; + private boolean fShowStatistics; + private int fResolutionTime; + private int fParsingTime; + private int fAddToIndexTime; + private int fErrorCount; + private int fReferenceCount= 0; + private int fDeclarationCount= 0; + private int fProblemBindingCount= 0; protected PDOMIndexerTask() { - String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/indexer"); //$NON-NLS-1$ - if (trace != null && trace.equalsIgnoreCase("true")) { //$NON-NLS-1$ - fTrace= true; - } + fTrace= checkDebugOption("indexer", "true"); //$NON-NLS-1$//$NON-NLS-2$ + fShowStatistics= checkDebugOption("pdomtimings", "true"); //$NON-NLS-1$//$NON-NLS-2$ + } + + private boolean checkDebugOption(String option, String value) { + String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/" + option); //$NON-NLS-1$ + return (trace != null && trace.equalsIgnoreCase(value)); } protected void processDelta(ICElementDelta delta, Collection added, Collection changed, Collection removed) throws CoreException { @@ -190,7 +203,9 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask { } fMessage= MessageFormat.format(Messages.PDOMIndexerTask_parsingFileTask, new Object[]{path.lastSegment(), path.removeLastSegments(1).toString()}); + long start= System.currentTimeMillis(); doParseTU(tu, pm); + fParsingTime += System.currentTimeMillis()-start; } catch (CoreException e) { swallowError(path, e); @@ -304,16 +319,28 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask { ArrayList[] arrayLists = ((ArrayList[]) symbolMap.get(path)); // resolve the names + long start= System.currentTimeMillis(); ArrayList names= arrayLists[2]; for (int j=0; j