Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2020-05-05 21:48:31 +0000
committerAndrey Loskutov2020-05-05 21:48:31 +0000
commit261283cb409f0bedd24b6e6d1b920375f2d487b0 (patch)
treef46e76c311d43ba92cb9bf90dd1c05328ae448a7
parent5242be46d1960c5063ff459292d90897eccf8a35 (diff)
downloadeclipse.jdt.core-261283cb409f0bedd24b6e6d1b920375f2d487b0.tar.gz
eclipse.jdt.core-261283cb409f0bedd24b6e6d1b920375f2d487b0.tar.xz
eclipse.jdt.core-261283cb409f0bedd24b6e6d1b920375f2d487b0.zip
Bug 562853 - Compiler build stats are wrong
Collect overall time to avoid none sense data printed with debug/builder/stats flag if number of compiled units exceeds 2000 (default in AbstractImageBuilder.MAX_AT_ONCE). Change-Id: I3296826fe6a65cde773c2579aea50fb4a31c30eb Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java4
3 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
index 3be180ea31..1ee7ac3e74 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -648,6 +648,7 @@ public class Compiler implements ITypeRequestor, ProblemSeverities {
reset();
this.annotationProcessorStartIndex = 0;
this.stats.endTime = System.currentTimeMillis();
+ this.stats.overallTime += this.stats.endTime - this.stats.startTime;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java
index 120c4b17f9..9fae8f5055 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java
@@ -19,6 +19,7 @@ public class CompilerStats implements Comparable {
// overall
public long startTime;
public long endTime;
+ public long overallTime;
public long lineCount;
// compile phases
@@ -32,7 +33,7 @@ public class CompilerStats implements Comparable {
* @return the time spent between start and end
*/
public long elapsedTime() {
- return this.endTime - this.startTime;
+ return this.overallTime;
}
@Override
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
index ec2f1f1dba..52b280c58d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
@@ -290,8 +290,8 @@ private void printStats() {
long time = compilerStats.elapsedTime();
long lineCount = compilerStats.lineCount;
double speed = ((int) (lineCount * 10000.0 / time)) / 10.0;
- System.out.println(">FULL BUILD STATS for: "+this.javaBuilder.javaProject.getElementName()); //$NON-NLS-1$
- System.out.println("> compiled " + lineCount + " lines in " + time + "ms:" + speed + " lines/s"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ System.out.println("\n>FULL BUILD STATS for: "+this.javaBuilder.javaProject.getElementName()); //$NON-NLS-1$
+ System.out.println("> compiled " + lineCount + " lines in " + time + " ms: " + speed + " lines/s"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.print("> parse: " + compilerStats.parseTime + " ms (" + ((int) (compilerStats.parseTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.out.print(", resolve: " + compilerStats.resolveTime + " ms (" + ((int) (compilerStats.resolveTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.out.print(", analyze: " + compilerStats.analyzeTime + " ms (" + ((int) (compilerStats.analyzeTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Back to the top