use of com.google.devtools.j2objc.util.TimeTracker in project j2objc by google.
the class TranslationProcessor method processConvertedTree.
@Override
protected void processConvertedTree(ProcessingContext input, CompilationUnit unit) {
String unitName = input.getOriginalSourcePath();
if (logger.isLoggable(Level.INFO)) {
System.out.println("translating " + unitName);
}
TimeTracker ticker = TimeTracker.getTicker(unitName, options.timingLevel());
if (options.dumpAST()) {
// Dump compilation unit to an .ast output file instead of translating.
DebugASTDump.dumpUnit(unit);
} else {
applyMutations(unit, deadCodeMap, ticker);
ticker.tick("Tree mutations");
ticker.printResults(System.out);
GenerationUnit genUnit = input.getGenerationUnit();
genUnit.addCompilationUnit(unit);
// Add out-of-date dependencies to translation list.
if (closureQueue != null) {
checkDependencies(unit);
}
if (genUnit.isFullyParsed()) {
generateObjectiveCSource(genUnit);
}
}
processedCount++;
}
use of com.google.devtools.j2objc.util.TimeTracker in project j2objc by google.
the class TranslationProcessor method generateObjectiveCSource.
@VisibleForTesting
public static void generateObjectiveCSource(GenerationUnit unit) {
assert unit.getOutputPath() != null;
assert unit.isFullyParsed();
TimeTracker ticker = TimeTracker.getTicker(unit.getSourceName(), unit.options().timingLevel());
logger.fine("Generating " + unit.getOutputPath());
logger.finest("writing output file(s) to " + unit.options().fileUtil().getOutputDirectory().getAbsolutePath());
ticker.push();
// write header
if (unit.options().generateSegmentedHeaders()) {
ObjectiveCSegmentedHeaderGenerator.generate(unit);
} else {
ObjectiveCHeaderGenerator.generate(unit);
}
ticker.tick("Header generation");
// write implementation file
ObjectiveCImplementationGenerator.generate(unit);
ticker.tick("Implementation generation");
unit.finished();
ticker.pop();
ticker.tick("Source generation");
ticker.printResults(System.out);
}
Aggregations