Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2009-10-27 15:14:38 +0000
committerVivian Kong2009-10-27 15:14:38 +0000
commitafe7f4e67b4960a99677e58b0aeb01bcd8bc4274 (patch)
tree5fbfb10ec9edf3f0c6e7f26bd6301ce779442116
parent5247786e30241c3cd08bebdb68dae4fd4a66cb23 (diff)
downloadorg.eclipse.cdt-afe7f4e67b4960a99677e58b0aeb01bcd8bc4274.tar.gz
org.eclipse.cdt-afe7f4e67b4960a99677e58b0aeb01bcd8bc4274.tar.xz
org.eclipse.cdt-afe7f4e67b4960a99677e58b0aeb01bcd8bc4274.zip
Bug 293385 - Log standalone indexer progress using IParserLogService instead of stdoutv200910271314
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFastIndexer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFullIndexer.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java29
4 files changed, 38 insertions, 12 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFastIndexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFastIndexer.java
index 17d5cfb11a5..36d5d8e8cfb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFastIndexer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFastIndexer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 QNX Software Systems and others.
+ * Copyright (c) 2006, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -97,7 +97,9 @@ public class StandaloneFastIndexer extends StandaloneIndexer {
*/
@Override
protected StandaloneIndexerTask createTask(List<String> added, List<String> changed, List<String> removed) {
- return new StandaloneFastIndexerTask(this, added, changed, removed);
+ StandaloneIndexerTask task = new StandaloneFastIndexerTask(this, added, changed, removed);
+ task.setLogService(getParserLog());
+ return task;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFullIndexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFullIndexer.java
index ae048c1f8a5..fd213c21226 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFullIndexer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneFullIndexer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 QNX Software Systems and others.
+ * Copyright (c) 2006, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -96,7 +96,9 @@ public class StandaloneFullIndexer extends StandaloneIndexer{
*/
@Override
protected StandaloneIndexerTask createTask(List<String> added, List<String> changed, List<String> removed) {
- return new StandaloneFullIndexerTask(this, added, changed, removed);
+ StandaloneIndexerTask task = new StandaloneFullIndexerTask(this, added, changed, removed);
+ task.setLogService(getParserLog());
+ return task;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
index cffe8b9ce48..45feeee12ae 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
@@ -85,7 +85,7 @@ public abstract class StandaloneIndexer {
protected IWritableIndex fIndex;
/**
- * A flag that indiciates if all files (sources without config, headers not included)
+ * A flag that indicates if all files (sources without config, headers not included)
* should be parsed.
*/
protected boolean fIndexAllFiles;
@@ -294,6 +294,13 @@ public abstract class StandaloneIndexer {
}
/**
+ * Sets the logger.
+ */
+ public void setParserLog(IParserLogService log) {
+ fLog = log;
+ }
+
+ /**
* Returns true if indexing activities should be shown.
* Otherwise, this method returns false.
*/
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
index b7f302371d6..6b09b6ba911 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,6 +44,7 @@ import org.eclipse.core.runtime.Status;
public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
protected StandaloneIndexer fIndexer;
+ protected IParserLogService fLogger;
public static final int[] IDS_FOR_LINKAGES_TO_INDEX = {
ILinkage.CPP_LINKAGE_ID, ILinkage.C_LINKAGE_ID, ILinkage.FORTRAN_LINKAGE_ID
@@ -137,20 +138,20 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
String name= getClass().getName();
name= name.substring(name.lastIndexOf('.')+1);
- System.out.println(name + " " //$NON-NLS-1$
+ trace(name + " " //$NON-NLS-1$
+ " (" + info.fCompletedSources + " sources, " //$NON-NLS-1$ //$NON-NLS-2$
+ info.fCompletedHeaders + " headers)"); //$NON-NLS-1$
boolean allFiles= getIndexAllFiles();
boolean skipRefs= fIndexer.getSkipReferences() == StandaloneIndexer.SKIP_ALL_REFERENCES;
boolean skipTypeRefs= skipRefs || fIndexer.getSkipReferences() == StandaloneIndexer.SKIP_TYPE_REFERENCES;
- System.out.println(name + " Options: " //$NON-NLS-1$
+ trace(name + " Options: " //$NON-NLS-1$
+ "parseAllFiles=" + allFiles //$NON-NLS-1$
+ ",skipReferences=" + skipRefs //$NON-NLS-1$
+ ", skipTypeReferences=" + skipTypeRefs //$NON-NLS-1$
+ "."); //$NON-NLS-1$
- System.out.println(name + " Timings: " //$NON-NLS-1$
+ trace(name + " Timings: " //$NON-NLS-1$
+ (System.currentTimeMillis() - start) + " total, " //$NON-NLS-1$
+ fStatistics.fParsingTime + " parser, " //$NON-NLS-1$
+ fStatistics.fResolutionTime + " resolution, " //$NON-NLS-1$
@@ -160,7 +161,7 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
NumberFormat nf= NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
- System.out.println(name + " Result: " //$NON-NLS-1$
+ trace(name + " Result: " //$NON-NLS-1$
+ fStatistics.fDeclarationCount + " declarations, " //$NON-NLS-1$
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
+ fStatistics.fErrorCount + " errors, " //$NON-NLS-1$
@@ -172,7 +173,7 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
long hits= index.getCacheHits();
long tries= misses+hits;
double missPct= tries==0 ? 0.0 : (double) misses / (double) tries;
- System.out.println(name + " Cache: " //$NON-NLS-1$
+ trace(name + " Cache: " //$NON-NLS-1$
+ hits + " hits, " //$NON-NLS-1$
+ misses + "(" + nf.format(missPct)+ ") misses."); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -214,15 +215,21 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
*/
@Override
protected IParserLogService getLogService() {
+ if (fLogger != null)
+ return fLogger;
return new StdoutLogService();
}
+
+ protected void setLogService(IParserLogService logService){
+ fLogger = logService;
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#logError(org.eclipse.core.runtime.IStatus)
*/
@Override
protected void logError(IStatus s) {
- getLogService().traceLog(s.getMessage());
+ trace(s.getMessage());
}
@SuppressWarnings("deprecation")
@@ -246,6 +253,14 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
protected int[] getLinkagesToParse() {
return IDS_FOR_LINKAGES_TO_INDEX;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.pdom.PDOMWriter#trace(java.lang.String)
+ */
+ @Override
+ protected void trace(String message) {
+ getLogService().traceLog(message);
+ }
}

Back to the top