use of de.dagere.peass.measurement.rca.searcher.CauseSearcher in project peass by DaGeRe.
the class RootCauseAnalysis method call.
@Override
public Void call() throws Exception {
if (testName == null) {
throw new RuntimeException("Test needs to be defined!");
}
initVersionProcessor();
if (version == null) {
version = executionData.getVersions().keySet().iterator().next();
LOG.info("Version was not defined, using " + version);
}
final TestCase test = new TestCase(testName);
final VersionStaticSelection versionInfo = staticTestSelection.getVersions().get(version);
boolean found = versionInfo.getTests().getTests().contains(test);
if (!found) {
LOG.error("Test " + test + " is not contained in regression test selection result, therefore it is unlikely to have a performance change!");
}
final String predecessor = versionInfo.getPredecessor();
LOG.debug("Timeout in minutes: {}", executionMixin.getTimeout());
final MeasurementConfig measurementConfiguration = getConfiguration(predecessor);
final CauseSearcherConfig causeSearcherConfig = new CauseSearcherConfig(test, causeSearchConfigMixin);
if (kiekerConfigMixin.isUseAggregation() && measurementConfiguration.getKiekerConfig().getRecord() == AllowedKiekerRecord.OPERATIONEXECUTION) {
throw new RuntimeException("Aggregation and OperationExecutionRecord can not be combined!");
}
final CauseSearchFolders alternateFolders = new CauseSearchFolders(folders.getProjectFolder());
final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, alternateFolders, new EnvironmentVariables());
final CauseSearcher tester = getCauseSeacher(measurementConfiguration, causeSearcherConfig, alternateFolders, reader);
tester.search();
return null;
}
use of de.dagere.peass.measurement.rca.searcher.CauseSearcher in project peass by DaGeRe.
the class RootCauseAnalysis method getCauseSeacher.
public static CauseSearcher getCauseSeacher(final MeasurementConfig measurementConfiguration, final CauseSearcherConfig causeSearcherConfig, final CauseSearchFolders alternateFolders, final BothTreeReader reader) throws IOException, InterruptedException {
if (measurementConfiguration.getKiekerConfig().isOnlyOneCallRecording()) {
throw new RuntimeException("isOnlyOneCallRecording is not allowed to be set to true for RCA!");
}
EnvironmentVariables env = reader.getEnv();
final CauseSearcher tester;
final CauseTester measurer = new CauseTester(alternateFolders, measurementConfiguration, causeSearcherConfig, env);
if (causeSearcherConfig.getRcaStrategy() != null) {
switch(causeSearcherConfig.getRcaStrategy()) {
case COMPLETE:
tester = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, alternateFolders, env);
break;
case LEVELWISE:
tester = new LevelCauseSearcher(reader, causeSearcherConfig, measurer, measurementConfiguration, alternateFolders, env);
break;
case UNTIL_SOURCE_CHANGE:
if (causeSearcherConfig.getPropertyFolder() == null) {
throw new RuntimeException("Property folder with correct source code needs to be defined if strategy is UNTIL_SOURCE_CHANGE!");
}
TreeAnalyzerCreator creatorSource = new TreeAnalyzerCreator() {
@Override
public TreeAnalyzer getAnalyzer(final BothTreeReader reader, final CauseSearcherConfig config) {
return new SourceChangeTreeAnalyzer(reader.getRootVersion(), reader.getRootPredecessor(), config.getPropertyFolder(), measurementConfiguration);
}
};
tester = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, alternateFolders, creatorSource, env);
break;
case UNTIL_STRUCTURE_CHANGE:
TreeAnalyzerCreator creator = new TreeAnalyzerCreator() {
@Override
public TreeAnalyzer getAnalyzer(final BothTreeReader reader, final CauseSearcherConfig config) {
return new StructureChangeTreeAnalyzer(reader.getRootVersion(), reader.getRootPredecessor());
}
};
tester = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, alternateFolders, creator, env);
break;
default:
throw new RuntimeException("Strategy " + causeSearcherConfig.getRcaStrategy() + " not expected");
}
} else {
LOG.info("Defaulting to StructureCauseSearcher");
TreeAnalyzerCreator creator = new TreeAnalyzerCreator() {
@Override
public TreeAnalyzer getAnalyzer(final BothTreeReader reader, final CauseSearcherConfig config) {
return new StructureChangeTreeAnalyzer(reader.getRootVersion(), reader.getRootPredecessor());
}
};
tester = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, alternateFolders, creator, env);
}
return tester;
}
use of de.dagere.peass.measurement.rca.searcher.CauseSearcher in project peass by DaGeRe.
the class CauseSearcherIT method testSlowerState.
@Test
public void testSlowerState() throws InterruptedException, IOException, IllegalStateException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
mockEnvironment(mockedVCS, mockedGitUtils);
final MeasurementConfig measurementConfiguration = new MeasurementConfig(5, VERSION, "000001~1");
measurementConfiguration.setUseKieker(true);
final CauseSearcherConfig causeSearcherConfig = CAUSE_CONFIG_TESTME_COMPLETE;
final CauseSearchFolders folders = new CauseSearchFolders(DependencyTestConstants.CURRENT);
final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, folders, new EnvironmentVariables());
EnvironmentVariables emptyEnv = new EnvironmentVariables();
final CauseTester measurer = new CauseTester(folders, measurementConfiguration, causeSearcherConfig, emptyEnv);
final CauseSearcher searcher = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, folders, emptyEnv);
final Set<ChangedEntity> changedEntities = searcher.search();
checkChangelistContainsChild12(changedEntities);
File expectedResultLogFolder = folders.getExistingRCALogFolder(VERSION, TESTCASE, 0);
File expectedResultLogFile = new File(expectedResultLogFolder, "vm_0_" + VERSION);
Assert.assertTrue("File " + expectedResultLogFolder.getAbsolutePath() + " does not exist ", expectedResultLogFolder.exists());
Assert.assertTrue("File " + expectedResultLogFile.getAbsolutePath() + " does not exist ", expectedResultLogFile.exists());
}
}
use of de.dagere.peass.measurement.rca.searcher.CauseSearcher in project peass by DaGeRe.
the class LevelCauseSearcherTest method searchChanges.
private void searchChanges(final CauseSearcherConfig config) throws IOException, XmlPullParserException, InterruptedException, ViewNotFoundException, AnalysisConfigurationException, JAXBException {
final CauseTester measurer = Mockito.mock(CauseTester.class);
CauseTesterMockUtil.mockMeasurement(measurer, builderPredecessor);
CauseSearchFolders folders = new CauseSearchFolders(folder);
final CauseSearcher searcher = new LevelCauseSearcher(treeReader, config, measurer, measurementConfig, folders, new EnvironmentVariables());
changes = searcher.search();
data = searcher.getRCAData();
}
use of de.dagere.peass.measurement.rca.searcher.CauseSearcher in project peass-ci-plugin by jenkinsci.
the class RCAExecutor method executeRCA.
private void executeRCA(final MeasurementConfig config, final TestCase testCase) throws IOException, InterruptedException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
final CauseSearcherConfig causeSearcherConfig = new CauseSearcherConfig(testCase, causeConfig);
config.setUseKieker(true);
final CauseSearchFolders alternateFolders = new CauseSearchFolders(projectFolder);
final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, config, alternateFolders, env);
CauseSearcher tester = SearchCauseStarter.getCauseSeacher(config, causeSearcherConfig, alternateFolders, reader);
tester.search();
}
Aggregations