use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ActiveRulesProvider method provide.
public ActiveRules provide(ActiveRulesLoader loader, ModuleQProfiles qProfiles) {
if (singleton == null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
singleton = load(loader, qProfiles);
profiler.stopInfo();
}
return singleton;
}
use of org.sonar.api.utils.log.Profiler in project sonarlint-core 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 sonar-java by SonarSource.
the class JavaClasspath method init.
@Override
protected void init() {
if (!initialized) {
validateLibraries = fs.hasFiles(fs.predicates().all());
Profiler profiler = Profiler.create(LOG).startInfo("JavaClasspath initialization");
initialized = true;
binaries = new ArrayList<>(getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_BINARIES));
Set<File> libraries = getFilesFromProperty(JavaClasspathProperties.SONAR_JAVA_LIBRARIES);
if (binaries.isEmpty() && libraries.isEmpty() && useDeprecatedProperties()) {
throw new AnalysisException("sonar.binaries and sonar.libraries are not supported since version 4.0 of sonar-java-plugin, please use sonar.java.binaries and sonar.java.libraries instead");
}
if (binaries.isEmpty() && hasMoreThanOneJavaFile()) {
if (isSonarLint()) {
LOG.warn("sonar.java.binaries is empty, please double check your configuration");
} else {
throw new AnalysisException("Please provide compiled classes of your project with sonar.java.binaries property");
}
}
elements = new ArrayList<>(binaries);
if (libraries.isEmpty() && hasJavaSources()) {
LOG.warn("Bytecode of dependencies was not provided for analysis of source files, " + "you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property");
}
elements.addAll(libraries);
profiler.stopInfo();
}
}
use of org.sonar.api.utils.log.Profiler in project sonar-java by SonarSource.
the class JavaSquid method scanTests.
private void scanTests(Collection<File> testFiles) {
Profiler profiler = Profiler.create(LOG).startInfo("Java Test Files AST scan");
astScannerForTests.scan(testFiles);
profiler.stopInfo();
}
use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.
the class ProfilingPreparedStatementHandler method invoke.
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().startsWith("execute")) {
Profiler profiler = Profiler.create(ProfiledDataSource.SQL_LOGGER).start();
Object result;
try {
result = InvocationUtils.invokeQuietly(statement, method, args);
} finally {
profiler.addContext("sql", SqlLogFormatter.reformatSql(sql));
if (sqlParams.length > 0) {
profiler.addContext("params", SqlLogFormatter.reformatParams(sqlParams));
}
profiler.stopTrace("");
}
return result;
} else if (method.getName().startsWith("set") && args.length > 1) {
sqlParams[(int) args[0] - 1] = args[1];
return InvocationUtils.invokeQuietly(statement, method, args);
} else {
return InvocationUtils.invokeQuietly(statement, method, args);
}
}
Aggregations