Tabnine Logo
Profiler.start
Code IndexAdd Tabnine to your IDE (free)

How to use
start
method
in
org.sonar.core.util.logs.Profiler

Best Java code snippets using org.sonar.core.util.logs.Profiler.start (Showing top 16 results out of 315)

origin: SonarSource/sonarqube

private void executeStep(Profiler stepProfiler, ComputationStep.Context context, ComputationStep step) {
 String status = "FAILED";
 stepProfiler.start();
 try {
  taskInterrupter.check(Thread.currentThread());
  step.execute(context);
  status = "SUCCESS";
 } finally {
  stepProfiler.addContext("status", status);
  stepProfiler.stopInfo(step.getDescription());
 }
}
origin: SonarSource/sonarqube

@Test
public void fail_if_stop_without_message() {
 underTest.start();
 try {
  underTest.stopInfo();
  fail();
 } catch (IllegalStateException e) {
  assertThat(e).hasMessage("Profiler#stopXXX() can't be called without any message defined in start methods");
 }
}
origin: SonarSource/sonarqube

@Test
public void start_writes_no_log_even_if_there_is_context() {
 underTest.addContext("a_string", "bar");
 underTest.addContext("null_value", null);
 underTest.addContext("an_int", 42);
 underTest.start();
 // do not write context as there's no message
 assertThat(tester.logs()).isEmpty();
}
origin: SonarSource/sonarqube

@Test
public void stopError_adds_context_after_time_by_default() {
 addSomeContext(underTest);
 underTest.start().stopError("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.ERROR).get(0))
  .startsWith("Rules registered | time=")
  .endsWith("ms | a_string=bar | an_int=42 | after_start=true");
}
origin: SonarSource/sonarqube

@Test
public void stopInfo_adds_context_after_time_by_default() {
 addSomeContext(underTest);
 underTest.start().stopInfo("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.INFO).get(0))
  .startsWith("Rules registered | time=")
  .endsWith("ms | a_string=bar | an_int=42 | after_start=true");
}
origin: SonarSource/sonarqube

@Test
public void stopInfo_clears_context() {
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopInfo("Foo");
 underTest.start().stopInfo("Bar");
 assertThat(tester.logs()).hasSize(2);
 List<String> logs = tester.logs(LoggerLevel.INFO);
 assertThat(logs.get(0))
   .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
   .endsWith("ms");
 assertThat(logs.get(1))
   .startsWith("Bar | time=")
   .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_adds_context_after_time_by_default() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.start().stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.TRACE).get(0))
  .startsWith("Rules registered | time=")
  .endsWith("ms | a_string=bar | an_int=42 | after_start=true");
}
origin: SonarSource/sonarqube

@Test
public void stopInfo_adds_context_before_time_if_logTimeLast_is_true() {
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopInfo("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.INFO).get(0))
  .startsWith("Rules registered | a_string=bar | an_int=42 | after_start=true | time=")
  .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopError_adds_context_before_time_if_logTimeLast_is_true() {
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopError("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.ERROR).get(0))
  .startsWith("Rules registered | a_string=bar | an_int=42 | after_start=true | time=")
  .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopDebug_clears_context() {
 tester.setLevel(LoggerLevel.DEBUG);
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopDebug("Foo");
 underTest.start().stopDebug("Bar");
 assertThat(tester.logs()).hasSize(2);
 List<String> logs = tester.logs(LoggerLevel.DEBUG);
 assertThat(logs.get(0))
   .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
   .endsWith("ms");
 assertThat(logs.get(1))
   .startsWith("Bar | time=")
   .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_clears_context() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopTrace("Foo");
 underTest.start().stopTrace("Bar");
 assertThat(tester.logs()).hasSize(2);
 List<String> logs = tester.logs(LoggerLevel.TRACE);
 assertThat(logs.get(0))
   .startsWith("Foo | a_string=bar | an_int=42 | after_start=true | time=")
   .endsWith("ms");
 assertThat(logs.get(1))
   .startsWith("Bar | time=")
   .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
public void stopTrace_adds_context_before_time_if_logTimeLast_is_true() {
 tester.setLevel(LoggerLevel.TRACE);
 addSomeContext(underTest);
 underTest.logTimeLast(true);
 underTest.start().stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs(LoggerLevel.TRACE).get(0))
  .startsWith("Rules registered | a_string=bar | an_int=42 | after_start=true | time=")
  .endsWith("ms");
}
origin: SonarSource/sonarqube

@Test
@UseDataProvider("logTimeLastValues")
public void log_on_at_stop(boolean logTimeLast) {
 underTest.logTimeLast(logTimeLast);
 tester.setLevel(LoggerLevel.TRACE);
 // trace
 underTest.start();
 underTest.stopTrace("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
 tester.clear();
 // debug
 underTest.start();
 underTest.stopDebug("Rules registered {} on {}", 6, 10);
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered 6 on 10 | time=");
 tester.clear();
 // info
 underTest.start();
 underTest.stopInfo("Rules registered");
 assertThat(tester.logs()).hasSize(1);
 assertThat(tester.logs().get(0)).startsWith("Rules registered | time=");
}
origin: SonarSource/sonarqube

p.start();
Map<String, Component> reportFilesByUuid = getReportFilesByUuid(this.rootHolder.getRoot());
context.getStatistics().add("reportFiles", reportFilesByUuid.size());
p.start();
ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByUuid, removedFileUuids, reportFileSourcesByUuid);
p.stopTrace("Score matrix computed");
p.start();
MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix);
origin: org.sonarsource.sonarqube/sonar-server

private void executeSteps(Profiler stepProfiler) {
 for (ComputationStep step : steps.instances()) {
  stepProfiler.start();
  step.execute();
  stepProfiler.stopDebug(step.getDescription());
 }
}
origin: org.sonarsource.sonarqube/sonar-server

p.start();
Map<String, DbComponent> dbFilesByKey = getDbFilesByKey();
if (dbFilesByKey.isEmpty()) {
p.start();
ScoreMatrix scoreMatrix = computeScoreMatrix(dbFilesByKey, removedFileKeys, reportFileSourcesByKey);
p.stopTrace("Score matrix computed");
p.start();
MatchesByScore matchesByScore = MatchesByScore.create(scoreMatrix);
org.sonar.core.util.logsProfilerstart

Popular methods of Profiler

  • create
  • stopInfo
  • startInfo
  • stopError
  • addContext
    Context information is removed if value is null.
  • createIfTrace
  • logTimeLast
    Defines whether time is added to stop messages before or after context (if any). flag is false by d
  • startTrace
  • stopTrace
  • hasContext
  • stopDebug
  • createIfDebug
  • stopDebug,
  • createIfDebug,
  • isDebugEnabled,
  • isTraceEnabled,
  • startDebug

Popular in Java

  • Creating JSON documents from java classes using gson
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • getContentResolver (Context)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JFileChooser (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now