Example usage for org.eclipse.jdt.internal.compiler.impl CompilerStats elapsedTime

List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerStats elapsedTime

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.impl CompilerStats elapsedTime.

Prototype

public long elapsedTime() 

Source Link

Document

Returns the total elapsed time (between start and end)

Usage

From source file:net.sf.j2s.core.builder.BatchImageBuilder.java

License:Open Source License

private void printStats() {
    if (this.compiler == null)
        return;//w  ww.j av  a  2 s.c o m
    CompilerStats compilerStats = this.compiler.stats;
    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.print(">   parse: " + compilerStats.parseTime + " ms (" //$NON-NLS-1$//$NON-NLS-2$
            + ((int) (compilerStats.parseTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$
    System.out.print(", resolve: " + compilerStats.resolveTime + " ms (" //$NON-NLS-1$//$NON-NLS-2$
            + ((int) (compilerStats.resolveTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$
    System.out.print(", analyze: " + compilerStats.analyzeTime + " ms (" //$NON-NLS-1$//$NON-NLS-2$
            + ((int) (compilerStats.analyzeTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$
    System.out.println(", generate: " + compilerStats.generateTime + " ms (" //$NON-NLS-1$//$NON-NLS-2$
            + ((int) (compilerStats.generateTime * 1000.0 / time)) / 10.0 + "%)"); //$NON-NLS-1$
}