mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
Bug 366570: Added tracing option.
This commit is contained in:
parent
105de6f15d
commit
e85390856a
2 changed files with 28 additions and 0 deletions
|
@ -9,6 +9,9 @@ org.eclipse.cdt.core/debug/parser=false
|
|||
# Prints parser stack traces
|
||||
org.eclipse.cdt.core/debug/parser/exceptions=false
|
||||
|
||||
# Reports statistics for building the structure to do resource lookups.
|
||||
org.eclipse.cdt.core/debug/resourceLookup=false
|
||||
|
||||
# Reports scanner activity
|
||||
org.eclipse.cdt.core/debug/scanner=false
|
||||
|
||||
|
|
|
@ -122,6 +122,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
|||
private boolean fNeedCleanup;
|
||||
private Node fLastFolderNode;
|
||||
|
||||
private boolean fTrace;
|
||||
|
||||
public ResourceLookupTree() {
|
||||
fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {};
|
||||
fFileExtensions= new HashMap<String, Extensions>();
|
||||
|
@ -133,6 +135,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
|||
}
|
||||
};
|
||||
fUnrefJob.setSystem(true);
|
||||
fTrace= "true".equals(Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/resourceLookup")); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
||||
public void startup() {
|
||||
|
@ -265,14 +268,36 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
|||
createFileNode(res.getFullPath(), null);
|
||||
}
|
||||
} else {
|
||||
long time=0, count=0;
|
||||
final boolean trace = fTrace && res instanceof IProject;
|
||||
if (trace) {
|
||||
time= System.currentTimeMillis();
|
||||
count= countNodes();
|
||||
}
|
||||
try {
|
||||
res.accept(this, 0);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
if (trace) {
|
||||
System.out.println("Built file lookup tree for " + res.getName() + ", took " + //$NON-NLS-1$//$NON-NLS-2$
|
||||
(System.currentTimeMillis() - time) + "ms to add " + (countNodes()-count) + " nodes."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long countNodes() {
|
||||
long result= 0;
|
||||
for (Object node : fNodeMap.values()) {
|
||||
if (node instanceof Node[]) {
|
||||
result += ((Node[]) node).length;
|
||||
} else {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a resource tree by using a resource proxy visitor.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue