Package org.sonar.api.utils

Examples of org.sonar.api.utils.TimeProfiler


  private ProjectReferentials projectReferentials;

  public ProjectReferentials provide(ProjectReferentialsLoader loader, ProjectReactor reactor, TaskProperties taskProps) {
    if (projectReferentials == null) {
      TimeProfiler profiler = new TimeProfiler(LOG).start("Load project referentials");
      try {
        projectReferentials = loader.load(reactor, taskProps);
      } finally {
        profiler.stop();
      }
    }
    return projectReferentials;
  }
View Full Code Here


  private GlobalReferentials globalReferentials;

  public GlobalReferentials provide(GlobalReferentialsLoader loader) {
    if (globalReferentials == null) {
      TimeProfiler profiler = new TimeProfiler(LOG).start("Load global referentials");
      try {
        globalReferentials = loader.load();
      } finally {
        profiler.stop();
      }
    }
    return globalReferentials;
  }
View Full Code Here

  private Rules singleton = null;

  public Rules provide(RuleDao ruleDao, DebtModel debtModel, Durations durations) {
    if (singleton == null) {
      TimeProfiler profiler = new TimeProfiler(LOG).start("Loading rules");
      singleton = load(ruleDao, (DefaultDebtModel) debtModel, durations);
      profiler.stop();
    }
    return singleton;
  }
View Full Code Here

    for (InputFile f : fs.inputFiles(fs.predicates().all())) {
      copyPreviousMeasuresForUnmodifiedFiles(context, filesToBlame, f);
    }
    if (!filesToBlame.isEmpty()) {
      LOG.info("SCM provider for this project is: " + configuration.provider().key());
      TimeProfiler profiler = new TimeProfiler().start("Retrieve SCM blame information");
      DefaultBlameOutput output = new DefaultBlameOutput(context, filesToBlame);
      configuration.provider().blameCommand().blame(new DefaultBlameInput(fs, filesToBlame), output);
      output.finish();
      profiler.stop();
    }
  }
View Full Code Here

    for (Initializer initializer : initializers) {
      eventBus.fireEvent(new InitializerExecutionEvent(initializer, true));
      executeMavenPlugin(initializer);

      TimeProfiler profiler = new TimeProfiler(LOG).start("Initializer " + initializer);
      initializer.execute(project);
      profiler.stop();
      eventBus.fireEvent(new InitializerExecutionEvent(initializer, false));
    }

    eventBus.fireEvent(new InitializersPhaseEvent(Lists.newArrayList(initializers), false));
  }
View Full Code Here

  private void executeMavenPlugin(Initializer sensor) {
    if (sensor instanceof DependsUponMavenPlugin) {
      MavenPluginHandler handler = ((DependsUponMavenPlugin) sensor).getMavenPluginHandler(project);
      if (handler != null) {
        TimeProfiler profiler = new TimeProfiler(LOG).start("Execute maven plugin " + handler.getArtifactId());
        mavenExecutor.execute(project, fs, handler);
        profiler.stop();
      }
    }
  }
View Full Code Here

    }
    return StringUtils.defaultString(source, "");
  }

  private String loadSourceFromWs(Resource resource) {
    TimeProfiler profiler = new TimeProfiler(LOG).start("Load previous source code of: " + resource.getEffectiveKey()).setLevelToDebug();
    try {
      return server
        .request("/api/sources/raw?key=" + ServerClient.encodeForUrl(resource.getEffectiveKey()), "GET", false, analysisMode.getPreviewReadTimeoutSec() * 1000);
    } catch (HttpDownloader.HttpException he) {
      if (he.getResponseCode() == 404) {
        return "";
      }
      throw he;
    } finally {
      profiler.stop();
    }
  }
View Full Code Here

  private DebtModel model;

  public DebtModel provide(CharacteristicDao dao) {
    if (model == null) {
      TimeProfiler profiler = new TimeProfiler(LOG).start("Loading technical debt model");
      model = load(dao);
      profiler.stop();
    }
    return model;
  }
View Full Code Here

  }

  @Override
  public final void execute(Project project, DefaultModuleFileSystem fs, String goal) {
    if (project.getPom() != null) {
      TimeProfiler profiler = new TimeProfiler().start("Execute " + goal);
      ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
      try {
        concreteExecute(project.getPom(), goal);
      } catch (Exception e) {
        throw new SonarException("Unable to execute maven plugin", e);
      } finally {
        // Reset original ClassLoader that may have been changed during Maven Execution (see SONAR-1800)
        Thread.currentThread().setContextClassLoader(currentClassLoader);
        profiler.stop();
      }
      if (!fs.isInitialized()) {
        pomConverter.synchronizeFileSystem(project.getPom(), fs);
      }
    }
View Full Code Here

  private void executeMavenPlugin(Sensor sensor) {
    if (sensor instanceof DependsUponMavenPlugin) {
      MavenPluginHandler handler = ((DependsUponMavenPlugin) sensor).getMavenPluginHandler(module);
      if (handler != null) {
        TimeProfiler profiler = new TimeProfiler(LOG).start("Execute maven plugin " + handler.getArtifactId());
        mavenExecutor.execute(module, fs, handler);
        profiler.stop();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.utils.TimeProfiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.