Search in sources :

Example 21 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class LevelCauseSearcherTest method testCauseSearching.

@Test
public void testCauseSearching() throws InterruptedException, IOException, IllegalStateException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
    buildRoots();
    searchChanges(TestConstants.SIMPLE_CAUSE_CONFIG);
    StrategyTestUtil.checkChanges(changes);
    final TestcaseStatistic nodeStatistic = data.getNodes().getStatistic();
    final double expectedT = new TTest().t(nodeStatistic.getStatisticsOld(), nodeStatistic.getStatisticsCurrent());
    Assert.assertEquals(expectedT, nodeStatistic.getTvalue(), 0.01);
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) TTest(org.apache.commons.math3.stat.inference.TTest) TTest(org.apache.commons.math3.stat.inference.TTest) Test(org.junit.Test)

Example 22 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class LevelCauseSearcherTest method testWarmup.

@Test
public void testWarmup() throws InterruptedException, IOException, IllegalStateException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
    measurementConfig = new MeasurementConfig(5, TestConstants.V2, TestConstants.V1);
    measurementConfig.setWarmup(500);
    measurementConfig.setIterations(5);
    builderPredecessor = new TreeBuilder(measurementConfig);
    buildRoots();
    searchChanges(TestConstants.SIMPLE_CAUSE_CONFIG);
    StrategyTestUtil.checkChanges(changes);
    final TestcaseStatistic nodeStatistic = data.getNodes().getStatistic();
    final double expectedT = new TTest().t(nodeStatistic.getStatisticsOld(), nodeStatistic.getStatisticsCurrent());
    System.out.println(nodeStatistic.getMeanCurrent());
    System.out.println(expectedT + " " + nodeStatistic.getTvalue());
    // Assert.assertEquals(nodeStatistic.getMeanCurrent());
    Assert.assertEquals(expectedT, nodeStatistic.getTvalue(), 0.01);
    Assert.assertEquals(95, nodeStatistic.getMeanCurrent(), 0.01);
    Assert.assertEquals(105, nodeStatistic.getMeanOld(), 0.01);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) TTest(org.apache.commons.math3.stat.inference.TTest) TreeBuilder(de.dagere.peass.measurement.rca.helper.TreeBuilder) TTest(org.apache.commons.math3.stat.inference.TTest) Test(org.junit.Test)

Example 23 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class TestNodePreparatorTreeStructure method init.

@BeforeEach
public void init() {
    csd.setConfig(new MeasurementConfig(15));
    rootNode.setStatistic(new TestcaseStatistic(5.0, 6.0, 0.01, 0.01, 15, -3, true, 10, 10));
    csd.setNodes(rootNode);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class TestNodePreparatorTreeStructure method testColorSettingAdded.

@Test
public void testColorSettingAdded() {
    final MeasuredNode childNode = new MeasuredNode("Call#myMethod", "public void Call.myMethod()", null);
    childNode.setStatistic(new TestcaseStatistic(Double.NaN, 6.0, Double.NaN, 0.01, 15, -3, true, 0, 10));
    rootNode.getChildren().add(childNode);
    csd.setNodes(rootNode);
    NodePreparator preparator = new NodePreparator(csd);
    preparator.prepare();
    GraphNode root = preparator.getRootNode();
    Assert.assertEquals(NodePreparator.COLOR_SLOWER, root.getColor());
    Assert.assertEquals(NodePreparator.COLOR_FASTER, root.getChildren().get(0).getColor());
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasuredNode(de.dagere.peass.measurement.rca.serialization.MeasuredNode) GraphNode(de.dagere.peass.visualization.GraphNode) NodePreparator(de.dagere.peass.visualization.NodePreparator) Test(org.junit.jupiter.api.Test)

Example 25 with TestcaseStatistic

use of de.dagere.peass.measurement.statistics.data.TestcaseStatistic in project peass by DaGeRe.

the class CallTreeNode method getPartialTestcaseStatistic.

@JsonIgnore
public TestcaseStatistic getPartialTestcaseStatistic() {
    final CallTreeStatistics currentVersionStatistics = data.get(config.getExecutionConfig().getVersion());
    final SummaryStatistics current = currentVersionStatistics.getStatistics();
    final CallTreeStatistics previousVersionStatistics = data.get(config.getExecutionConfig().getVersionOld());
    final SummaryStatistics previous = previousVersionStatistics.getStatistics();
    if (firstHasValues(current, previous)) {
        final TestcaseStatistic testcaseStatistic = new TestcaseStatistic(previous, current, 0, currentVersionStatistics.getCalls());
        testcaseStatistic.setChange(true);
        return testcaseStatistic;
    } else if (firstHasValues(previous, current)) {
        final TestcaseStatistic testcaseStatistic = new TestcaseStatistic(previous, current, previousVersionStatistics.getCalls(), 0);
        testcaseStatistic.setChange(true);
        return testcaseStatistic;
    } else if ((current == null || current.getN() == 0) && (previous == null || previous.getN() == 0)) {
        LOG.error("Could not measure {}", this);
        final TestcaseStatistic testcaseStatistic = new TestcaseStatistic(previous, current, 0, 0);
        testcaseStatistic.setChange(true);
        return testcaseStatistic;
    } else {
        throw new RuntimeException("Partial statistics should exactly be created if one node is unmeasurable");
    }
}
Also used : TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) SummaryStatistics(org.apache.commons.math3.stat.descriptive.SummaryStatistics) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Aggregations

TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)28 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)7 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)5 File (java.io.File)5 Map (java.util.Map)5 SummaryStatistics (org.apache.commons.math3.stat.descriptive.SummaryStatistics)5 Test (org.junit.Test)5 TTest (org.apache.commons.math3.stat.inference.TTest)4 Test (org.junit.jupiter.api.Test)4 BuildMeasurementValues (de.dagere.peass.ci.persistence.BuildMeasurementValues)3 TestMeasurementValues (de.dagere.peass.ci.persistence.TestMeasurementValues)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 MeasuredNode (de.dagere.peass.measurement.rca.serialization.MeasuredNode)3 LinkedHashMap (java.util.LinkedHashMap)3 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)2 DefaultMeasurementVisualizer (de.dagere.peass.ci.helper.DefaultMeasurementVisualizer)2 TreeBuilder (de.dagere.peass.measurement.rca.helper.TreeBuilder)2 GraphNode (de.dagere.peass.visualization.GraphNode)2 NodePreparator (de.dagere.peass.visualization.NodePreparator)2 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1