use of org.sonar.api.utils.log.Profiler in project sonar-java by SonarSource.
the class JavaSquid method scanSources.
private void scanSources(Collection<File> sourceFiles) {
Profiler profiler = Profiler.create(LOG).startInfo("Java Main Files AST scan");
astScanner.scan(sourceFiles);
profiler.stopInfo();
}
use of org.sonar.api.utils.log.Profiler in project sonar-java by SonarSource.
the class JavaTestClasspath method init.
@Override
protected void init() {
if (!initialized) {
validateLibraries = fs.hasFiles(fs.predicates().all());
Profiler profiler = Profiler.create(LOG).startInfo("JavaTestClasspath initialization");
initialized = true;
binaries = new ArrayList<>(getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_TEST_BINARIES));
Set<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_TEST_LIBRARIES);
if (libraries.isEmpty() && hasJavaSources()) {
LOG.warn("Bytecode of dependencies was not provided for analysis of test files, you might end up with less precise results. " + "Bytecode can be provided using sonar.java.test.libraries property");
}
elements = new ArrayList<>(binaries);
elements.addAll(libraries);
profiler.stopInfo();
}
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class IndexerStartupTask method indexEmptyTypes.
private void indexEmptyTypes(StartupIndexer indexer) {
Set<IndexType> uninizializedTypes = getUninitializedTypes(indexer);
if (!uninizializedTypes.isEmpty()) {
Profiler profiler = Profiler.create(LOG);
profiler.startInfo(getLogMessage(uninizializedTypes, "..."));
indexer.indexOnStartup(uninizializedTypes);
uninizializedTypes.forEach(this::setInitialized);
profiler.stopInfo(getLogMessage(uninizializedTypes, "done"));
}
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ComponentContainer method createPicoContainer.
public static MutablePicoContainer createPicoContainer() {
ReflectionLifecycleStrategy lifecycleStrategy = new ReflectionLifecycleStrategy(new NullComponentMonitor(), "start", "stop", "close") {
@Override
public void start(Object component) {
Profiler profiler = Profiler.createIfTrace(Loggers.get(ComponentContainer.class));
profiler.start();
super.start(component);
profiler.stopTrace(component.getClass().getCanonicalName() + " started");
}
};
return new ExtendedDefaultPicoContainer(new OptInCaching(), lifecycleStrategy, null);
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ScannerWsClient method call.
/**
* If an exception is not thrown, the response needs to be closed by either calling close() directly, or closing the
* body content's stream/reader.
* @throws IllegalStateException if the request could not be executed due to
* a connectivity problem or timeout. Because networks can
* fail during an exchange, it is possible that the remote server
* accepted the request before the failure
* @throws HttpException if the response code is not in range [200..300)
*/
public WsResponse call(WsRequest request) {
Preconditions.checkState(!globalMode.isMediumTest(), "No WS call should be made in medium test mode");
Profiler profiler = Profiler.createIfDebug(LOG).start();
WsResponse response = target.wsConnector().call(request);
profiler.stopDebug(format("%s %d %s", request.getMethod(), response.code(), response.requestUrl()));
failIfUnauthorized(response);
return response;
}
Aggregations