use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.
the class MigrationStepsExecutorImpl method execute.
@Override
public void execute(Stream<RegisteredMigrationStep> steps) {
Profiler globalProfiler = Profiler.create(LOGGER);
globalProfiler.startInfo(GLOBAL_START_MESSAGE);
boolean allStepsExecuted = false;
try {
steps.forEachOrdered(this::execute);
allStepsExecuted = true;
} finally {
if (allStepsExecuted) {
globalProfiler.stopInfo(GLOBAL_END_MESSAGE, "success");
} else {
globalProfiler.stopError(GLOBAL_END_MESSAGE, "failure");
}
}
}
use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.
the class MigrationStepsExecutorImpl method execute.
private void execute(RegisteredMigrationStep step, MigrationStep migrationStep) {
Profiler stepProfiler = Profiler.create(LOGGER);
stepProfiler.startInfo(STEP_START_PATTERN, step);
boolean done = false;
try {
migrationStep.execute();
migrationHistory.done(step);
done = true;
} catch (Exception e) {
throw new MigrationStepExecutionException(step, e);
} finally {
if (done) {
stepProfiler.stopInfo(STEP_STOP_PATTERN, step, "success");
} else {
stepProfiler.stopError(STEP_STOP_PATTERN, step, "failure");
}
}
}
use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.
the class VisitorsCrawler method visitNode.
private void visitNode(Component component, VisitorWrapper visitor) {
Profiler profiler = Profiler.create(Loggers.get(visitor.getWrappedVisitor().getClass())).startTrace("Visiting component {}", component.getKey());
visitor.visitAny(component);
switch(component.getType()) {
case PROJECT:
visitor.visitProject(component);
break;
case MODULE:
visitor.visitModule(component);
break;
case DIRECTORY:
visitor.visitDirectory(component);
break;
case FILE:
visitor.visitFile(component);
break;
case VIEW:
visitor.visitView(component);
break;
case SUBVIEW:
visitor.visitSubView(component);
break;
case PROJECT_VIEW:
visitor.visitProjectView(component);
break;
default:
throw new IllegalStateException(String.format("Unknown type %s", component.getType().name()));
}
long duration = profiler.stopTrace();
incrementDuration(visitor, duration);
}
use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.
the class ComputationStepExecutor method execute.
public void execute() {
Profiler stepProfiler = Profiler.create(LOGGER);
boolean allStepsExecuted = false;
try {
executeSteps(stepProfiler);
allStepsExecuted = true;
} finally {
if (listener != null) {
executeListener(allStepsExecuted);
}
}
}
use of org.sonar.core.util.logs.Profiler in project sonarqube by SonarSource.
the class DatabaseMigrationImpl method doUpgradeDb.
private void doUpgradeDb() {
Profiler profiler = Profiler.createIfTrace(LOGGER);
profiler.startTrace("Starting DB Migration");
migrationEngine.execute();
profiler.stopTrace("DB Migration ended");
}
Aggregations