Search in sources :

Example 1 with CauseSearcher

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;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig)

Example 2 with CauseSearcher

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;
}
Also used : LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) SourceChangeTreeAnalyzer(de.dagere.peass.measurement.rca.analyzer.SourceChangeTreeAnalyzer) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) StructureChangeTreeAnalyzer(de.dagere.peass.measurement.rca.analyzer.StructureChangeTreeAnalyzer) CauseSearcherComplete(de.dagere.peass.measurement.rca.searcher.CauseSearcherComplete) CauseTester(de.dagere.peass.measurement.rca.CauseTester) TreeAnalyzerCreator(de.dagere.peass.measurement.rca.searcher.TreeAnalyzerCreator) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig)

Example 3 with CauseSearcher

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());
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearcherComplete(de.dagere.peass.measurement.rca.searcher.CauseSearcherComplete) GitUtils(de.dagere.peass.vcs.GitUtils) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) File(java.io.File) Test(org.junit.Test)

Example 4 with CauseSearcher

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();
}
Also used : CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) CauseTester(de.dagere.peass.measurement.rca.CauseTester) LevelCauseSearcher(de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher)

Example 5 with CauseSearcher

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();
}
Also used : CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) CauseSearcherConfig(de.dagere.peass.measurement.rca.CauseSearcherConfig)

Aggregations

CauseSearcher (de.dagere.peass.measurement.rca.searcher.CauseSearcher)5 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)4 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)4 BothTreeReader (de.dagere.peass.measurement.rca.kieker.BothTreeReader)4 CauseSearcherConfig (de.dagere.peass.measurement.rca.CauseSearcherConfig)3 LevelCauseSearcher (de.dagere.peass.measurement.rca.searcher.LevelCauseSearcher)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)2 CauseTester (de.dagere.peass.measurement.rca.CauseTester)2 CauseSearcherComplete (de.dagere.peass.measurement.rca.searcher.CauseSearcherComplete)2 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)1 SourceChangeTreeAnalyzer (de.dagere.peass.measurement.rca.analyzer.SourceChangeTreeAnalyzer)1 StructureChangeTreeAnalyzer (de.dagere.peass.measurement.rca.analyzer.StructureChangeTreeAnalyzer)1 TreeAnalyzerCreator (de.dagere.peass.measurement.rca.searcher.TreeAnalyzerCreator)1 GitUtils (de.dagere.peass.vcs.GitUtils)1 VersionControlSystem (de.dagere.peass.vcs.VersionControlSystem)1 File (java.io.File)1 Test (org.junit.Test)1