added basic timing output to logs for hover and completion computation

This commit is contained in:
Martin Lippert
2021-03-02 12:15:36 +01:00
parent aaf16eabb2
commit f0981b52f0
2 changed files with 10 additions and 2 deletions

View File

@@ -122,6 +122,8 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
@Override
public CompletionList getCompletions(CancelChecker cancelToken, TextDocumentPositionParams params) {
long start = System.currentTimeMillis();
SimpleTextDocumentService documents = server.getTextDocumentService();
TextDocument doc = documents.getLatestSnapshot(params);
@@ -195,7 +197,8 @@ public class VscodeCompletionEngineAdapter implements VscodeCompletionEngine {
log.info("error while compututing completions", e);
}
finally {
log.info("Got {} completions", list.getItems().size());
long end = System.currentTimeMillis();
log.info("Got {} completions in " + (end - start) + "ms", list.getItems().size());
}
}

View File

@@ -302,7 +302,10 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
}
private Hover computeHover(CancelChecker cancelToken, HoverParams hoverParams) {
long start = System.currentTimeMillis();
try {
log.debug("hover handler starting");
HoverHandler h = hoverHandler;
if (h != null) {
@@ -311,8 +314,10 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
}
log.debug("no hover because there is no handler");
return null;
} finally {
log.debug("hover handler finished");
long end = System.currentTimeMillis();
log.info("hover computation done in " + (end - start) + "ms");
}
}