Search in sources :

Example 1 with StoppedTask

use of org.eclipse.xtext.util.internal.Stopwatches.StoppedTask in project xtext-core by eclipse.

the class ResourceValidatorImpl method validate.

@Override
public List<Issue> validate(Resource resource, final CheckMode mode, CancelIndicator mon) throws OperationCanceledError {
    StoppedTask task = Stopwatches.forTask("ResourceValidatorImpl.validation");
    try {
        task.start();
        final CancelIndicator monitor = mon == null ? CancelIndicator.NullImpl : mon;
        resolveProxies(resource, monitor);
        operationCanceledManager.checkCanceled(monitor);
        final List<Issue> result = Lists.newArrayListWithExpectedSize(resource.getErrors().size() + resource.getWarnings().size());
        try {
            IAcceptor<Issue> acceptor = createAcceptor(result);
            if (mode.shouldCheck(CheckType.FAST)) {
                collectResourceDiagnostics(resource, monitor, acceptor);
            }
            operationCanceledManager.checkCanceled(monitor);
            boolean syntaxDiagFail = !result.isEmpty();
            logCheckStatus(resource, syntaxDiagFail, "Syntax");
            validate(resource, mode, monitor, acceptor);
            operationCanceledManager.checkCanceled(monitor);
        } catch (RuntimeException e) {
            operationCanceledManager.propagateAsErrorIfCancelException(e);
            log.error(e.getMessage(), e);
        }
        return result;
    } finally {
        task.stop();
    }
}
Also used : StoppedTask(org.eclipse.xtext.util.internal.Stopwatches.StoppedTask) CancelIndicator(org.eclipse.xtext.util.CancelIndicator)

Example 2 with StoppedTask

use of org.eclipse.xtext.util.internal.Stopwatches.StoppedTask in project xtext-core by eclipse.

the class AbstractCleaningLinker method linkModel.

@Override
public void linkModel(EObject model, IDiagnosticConsumer diagnosticsConsumer) {
    StoppedTask task = Stopwatches.forTask("installing proxies (AbstractCleaningLinker.linkModel)");
    task.start();
    boolean debug = log.isDebugEnabled();
    long time = System.currentTimeMillis();
    beforeModelLinked(model, diagnosticsConsumer);
    if (debug) {
        long now = System.currentTimeMillis();
        log.debug("beforeModelLinked took: " + (now - time) + "ms");
        time = now;
    }
    doLinkModel(model, diagnosticsConsumer);
    if (debug) {
        long now = System.currentTimeMillis();
        log.debug("doLinkModel took: " + (now - time) + "ms");
        time = now;
    }
    afterModelLinked(model, diagnosticsConsumer);
    if (debug) {
        long now = System.currentTimeMillis();
        log.debug("afterModelLinked took: " + (now - time) + "ms");
        time = now;
    }
    task.stop();
}
Also used : StoppedTask(org.eclipse.xtext.util.internal.Stopwatches.StoppedTask)

Example 3 with StoppedTask

use of org.eclipse.xtext.util.internal.Stopwatches.StoppedTask in project xtext-xtend by eclipse.

the class PartialParserBenchmark method measure.

public int measure() throws Exception {
    System.out.println(fileName);
    StoppedTask task = Stopwatches.forTask(fileName);
    try {
        task.start();
        return doTime(parser, 1);
    } finally {
        task.stop();
        System.out.println("done");
    }
}
Also used : StoppedTask(org.eclipse.xtext.util.internal.Stopwatches.StoppedTask)

Aggregations

StoppedTask (org.eclipse.xtext.util.internal.Stopwatches.StoppedTask)3 CancelIndicator (org.eclipse.xtext.util.CancelIndicator)1