aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2014-10-30 20:35:06 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2014-10-30 21:19:32 +0100
commit34a501e8a0c1764c111c12ab759d594b0c5fd729 (patch)
treec7dc38bcba2100a984cc722784213d7c7927a130
parent78f292cad7cab9cfc654173c3184c91bd66af668 (diff)
downloadsonarqube-34a501e8a0c1764c111c12ab759d594b0c5fd729.tar.gz
sonarqube-34a501e8a0c1764c111c12ab759d594b0c5fd729.zip
SONAR-5793 Use TimeProfiler for logs to have duration in compute engine
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
index 9069f9d63f2..b49f2dce617 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/ComputationService.java
@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.ServerComponent;
import org.sonar.api.utils.System2;
+import org.sonar.api.utils.TimeProfiler;
import org.sonar.core.activity.Activity;
import org.sonar.core.component.ComponentDto;
import org.sonar.core.computation.db.AnalysisReportDto;
@@ -54,7 +55,7 @@ public class ComputationService implements ServerComponent {
}
public void analyzeReport(AnalysisReportDto report) {
- LOG.info(String.format("#%s - %s - Analysis report processing started", report.getId(), report.getProjectKey()));
+ TimeProfiler profiler = new TimeProfiler(LOG).start(String.format("#%s - %s - Analysis report processing", report.getId(), report.getProjectKey()));
// Synchronization of a lot of data can only be done with a batch session for the moment
DbSession session = dbClient.openSession(true);
@@ -64,10 +65,10 @@ public class ComputationService implements ServerComponent {
try {
report.succeed();
for (ComputationStep step : stepRegistry.steps()) {
- LOG.info(String.format("%s step started", step.description()));
+ TimeProfiler stepProfiler = new TimeProfiler(LOG).start(step.description());
step.execute(session, report, project);
session.commit();
- LOG.info(String.format("%s step finished", step.description()));
+ stepProfiler.stop();
}
} catch (Exception exception) {
@@ -77,7 +78,7 @@ public class ComputationService implements ServerComponent {
logActivity(session, report, project);
session.commit();
MyBatis.closeQuietly(session);
- LOG.info(String.format("#%s - %s - Analysis report processing finished", report.getId(), report.getProjectKey()));
+ profiler.stop();
}
}