Search in sources :

Example 26 with Profiler

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();
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Example 27 with Profiler

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();
    }
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) InputFile(org.sonar.api.batch.fs.InputFile) File(java.io.File)

Example 28 with Profiler

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"));
    }
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Example 29 with Profiler

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);
}
Also used : OptInCaching(org.picocontainer.behaviors.OptInCaching) Profiler(org.sonar.api.utils.log.Profiler) NullComponentMonitor(org.picocontainer.monitors.NullComponentMonitor) ReflectionLifecycleStrategy(org.picocontainer.lifecycle.ReflectionLifecycleStrategy)

Example 30 with Profiler

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;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) WsResponse(org.sonarqube.ws.client.WsResponse)

Aggregations

Profiler (org.sonar.api.utils.log.Profiler)56 Bean (org.springframework.context.annotation.Bean)7 HashMap (java.util.HashMap)6 IOException (java.io.IOException)5 DbSession (org.sonar.db.DbSession)5 GetRequest (org.sonarqube.ws.client.GetRequest)5 File (java.io.File)3 Reader (java.io.Reader)3 RulesDefinition (org.sonar.api.server.rule.RulesDefinition)3 InputStream (java.io.InputStream)2 Path (java.nio.file.Path)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 CheckForNull (javax.annotation.CheckForNull)2 OptInCaching (org.picocontainer.behaviors.OptInCaching)2 ReflectionLifecycleStrategy (org.picocontainer.lifecycle.ReflectionLifecycleStrategy)2 NullComponentMonitor (org.picocontainer.monitors.NullComponentMonitor)2 InputFile (org.sonar.api.batch.fs.InputFile)2 NewRule (org.sonar.api.batch.rule.internal.NewRule)2 RulesBuilder (org.sonar.api.batch.rule.internal.RulesBuilder)2