Search in sources :

Example 1 with HistogramReader

use of de.dagere.peass.ci.helper.HistogramReader in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testHistogramCreation.

@Test
public void testHistogramCreation() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("b02c92af73e3297be617f4c973a7a63fb603565b");
    measurementConfig.getExecutionConfig().setVersionOld("e80d8a1bf747d1f70dc52260616b36cac9e44561");
    measurementConfig.setWarmup(2);
    measurementConfig.setIterations(2);
    measurementConfig.setRepetitions(2);
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "b02c92af73e3297be617f4c973a7a63fb603565b"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    double[] valuesBefore = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesBefore();
    double[] valuesCurrent = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesCurrent();
    MeasureVersionAction measureVersionActionMock = Mockito.mock(MeasureVersionAction.class);
    when(measureVersionActionMock.getValuesReadable(any(double[].class))).thenCallRealMethod();
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesBefore).split(",").length);
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesCurrent).split(",").length);
    Assert.assertFalse(reader.measurementConfigurationUpdated());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Example 2 with HistogramReader

use of de.dagere.peass.ci.helper.HistogramReader in project peass-ci-plugin by jenkinsci.

the class LocalPeassProcessManager method visualizeMeasurementResults.

public ProjectChanges visualizeMeasurementResults(final Run<?, ?> run) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
    File dataFolder = results.getVersionFullResultsFolder(peassConfig.getMeasurementConfig());
    final HistogramReader histogramReader = new HistogramReader(peassConfig.getMeasurementConfig(), dataFolder);
    final Map<String, HistogramValues> measurements = histogramReader.readMeasurements();
    final ProjectChanges changes = getChanges();
    final ProjectStatistics statistics = readStatistics();
    TrendFileUtil.persistTrend(run, localWorkspace, statistics);
    Map<String, TestcaseStatistic> noWarmupStatistics = createPureMeasurementVisualization(run, dataFolder, measurements);
    Changes versionChanges = changes.getVersion(peassConfig.getMeasurementConfig().getExecutionConfig().getVersion());
    final MeasureVersionAction action = new MeasureVersionAction(peassConfig.getMeasurementConfig(), versionChanges, statistics, noWarmupStatistics, measurements, histogramReader.getUpdatedConfigurations());
    run.addAction(action);
    return changes;
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Changes(de.dagere.peass.analysis.changes.Changes) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues)

Example 3 with HistogramReader

use of de.dagere.peass.ci.helper.HistogramReader in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testEmptyHistogram.

@Test
public void testEmptyHistogram() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("e80d8a1bf747d1f70dc52260616b36cac9e44561");
    measurementConfig.getExecutionConfig().setVersionOld("e80d8a1bf747d1f70dc52260616b36cac9e44561~1");
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "e80d8a1bf747d1f70dc52260616b36cac9e44561"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    Assert.assertNull(measurements.get("e80d8a1bf747d1f70dc52260616b36cac9e44561"));
    Assert.assertFalse(reader.measurementConfigurationUpdated());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Example 4 with HistogramReader

use of de.dagere.peass.ci.helper.HistogramReader in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testUpdatedConfiguration.

@Test
public void testUpdatedConfiguration() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("a23e385264c31def8dcda86c3cf64faa698c62d8");
    measurementConfig.getExecutionConfig().setVersionOld("33ce17c04b5218c25c40137d4d09f40fbb3e4f0f");
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "measurement_a23e385264c31def8dcda86c3cf64faa698c62d8_33ce17c04b5218c25c40137d4d09f40fbb3e4f0f"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    double[] valuesBefore = measurements.get("de.test.CalleeTest#onlyCallMethod2").getValuesBefore();
    double[] valuesCurrent = measurements.get("de.test.CalleeTest#onlyCallMethod2").getValuesCurrent();
    MeasureVersionAction measureVersionActionMock = Mockito.mock(MeasureVersionAction.class);
    when(measureVersionActionMock.getValuesReadable(any(double[].class))).thenCallRealMethod();
    Assert.assertEquals(measureVersionActionMock.getValuesReadable(valuesBefore).split(",").length, 2);
    Assert.assertEquals(measureVersionActionMock.getValuesReadable(valuesCurrent).split(",").length, 2);
    Assert.assertTrue(reader.measurementConfigurationUpdated());
    MeasurementConfig updatedConfig = reader.getUpdatedConfigurations().get("de.test.CalleeTest#onlyCallMethod2");
    Assert.assertEquals(updatedConfig.getIterations(), 2);
    Assert.assertEquals(updatedConfig.getRepetitions(), 200);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Aggregations

HistogramReader (de.dagere.peass.ci.helper.HistogramReader)4 HistogramValues (de.dagere.peass.ci.helper.HistogramValues)4 File (java.io.File)4 MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 Test (org.junit.jupiter.api.Test)3 Changes (de.dagere.peass.analysis.changes.Changes)1 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)1 TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)1