Search in sources :

Example 1 with TestData

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

the class FindLowestPossibleIterations method call.

@Override
public Void call() throws InterruptedException, StreamReadException, DatabindException, IOException {
    final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
    VersionComparator.setDependencies(dependencies);
    for (File fullDataFolder : data) {
        LOG.info("Loading: {}", fullDataFolder);
        if (!fullDataFolder.exists()) {
            LOG.error("Ordner existiert nicht!");
            System.exit(1);
        }
        final LinkedBlockingQueue<TestData> measurements = new LinkedBlockingQueue<>();
        DataReader.startReadVersionDataMap(fullDataFolder, measurements);
        TestData measurementEntry = measurements.take();
        while (measurementEntry != DataReader.POISON_PILL) {
            processTestdata(measurementEntry);
            measurementEntry = measurements.take();
        }
    }
    LOG.debug("Final minimal VM executions for same result: " + vmDeterminer.getMinNeccessaryValue() + " Average: " + ((double) vmDeterminer.getSum() / vmDeterminer.getCount()));
    LOG.debug(vmDeterminer.getValues());
    return null;
// LOG.debug("Final minimal measurement executions for same result: " + exDeterminer.minNeccessaryValue + " Average: " + ((double) exDeterminer.sum / exDeterminer.count));
// LOG.debug(exDeterminer.values);
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 2 with TestData

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

the class IsThereTimeReductionIterations method analyze.

public void analyze(final File[] data) throws InterruptedException {
    for (File folder : data) {
        for (final File slaveFolder : folder.listFiles()) {
            final File fullDataFolder = new File(slaveFolder, "measurementsFull/measurements/");
            final LinkedBlockingQueue<TestData> measurements = new LinkedBlockingQueue<>();
            DataReader.startReadVersionDataMap(fullDataFolder, measurements);
            TestData measurementEntry = measurements.take();
            while (measurementEntry != DataReader.POISON_PILL) {
                try {
                    System.out.println("Analyze: " + measurementEntry.getTestClass());
                    processTestdata(measurementEntry);
                } catch (final RuntimeException e) {
                }
                measurementEntry = measurements.take();
            }
        }
    }
    System.out.println("Additional: " + additionalFound + " Wrong: " + lessfound + " Speedup:" + speedup + " Tests: " + count);
    System.out.println("Average Iterations: " + avgcount / vms);
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) File(java.io.File)

Example 3 with TestData

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

the class DataReader method readDataToQueue.

private static void readDataToQueue(final File fullDataFolder, final LinkedBlockingQueue<TestData> measurements) {
    LOG.info("Loading folder: {}", fullDataFolder);
    for (final File clazzFile : fullDataFolder.listFiles()) {
        final Map<String, TestData> currentMeasurement = readClassFolder(clazzFile);
        for (final TestData data : currentMeasurement.values()) {
            LOG.debug("Add: {}", data.getTestClass() + " " + data.getTestMethod());
            while (measurements.size() > MAX_QUEUE_SIZE) {
                LOG.info("Waiting, Measurements: {} Max-Queue-Size: {}", measurements.size(), MAX_QUEUE_SIZE);
                try {
                    Thread.sleep(1000);
                } catch (final InterruptedException e) {
                    e.printStackTrace();
                }
            }
            measurements.add(data);
            size += data.getVersions();
        }
    }
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) File(java.io.File)

Example 4 with TestData

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

the class DataReader method readMeasurementFile.

private static void readMeasurementFile(final Map<String, TestData> currentMeasurement, final File versionOfPair, final File versionCurrent, final File measurementFile) {
    try {
        final Kopemedata resultData = new XMLDataLoader(measurementFile).getFullData();
        final String testclazz = resultData.getTestcases().getClazz();
        TestCase testcase = new TestCase(resultData.getTestcases());
        TestData testData = currentMeasurement.get(testcase.getMethodWithParams());
        if (testData == null) {
            final File originFile = measurementFile.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getParentFile();
            testData = new TestData(testcase, originFile);
            currentMeasurement.put(testcase.getMethodWithParams(), testData);
        }
        String predecessor = null;
        final File[] versionFiles = versionOfPair.listFiles();
        for (final File version : versionFiles) {
            if (!version.getName().equals(versionOfPair.getName())) {
                predecessor = version.getName();
            }
        }
        if (predecessor != null) {
            testData.addMeasurement(versionOfPair.getName(), versionCurrent.getName(), predecessor, resultData);
        } else {
            LOG.error("No predecessor data for {} {} {} {}", versionCurrent.getName(), predecessor, testclazz, testcase.getMethodWithParams());
        }
    } catch (final JAXBException e) {
        LOG.error("An exception occured during reading the measurement results");
        e.printStackTrace();
    }
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) JAXBException(javax.xml.bind.JAXBException) XMLDataLoader(de.dagere.kopeme.datastorage.XMLDataLoader) Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File)

Example 5 with TestData

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

the class DependencyTester method postEvaluate.

public void postEvaluate() {
    if (currentOrganizer != null) {
        final File cleanFolder = folders.getNativeCleanFolder();
        if (!cleanFolder.exists()) {
            cleanFolder.mkdirs();
        }
        final Cleaner cleaner = new Cleaner(cleanFolder);
        for (final File clazzFile : folders.getDetailResultFolder().listFiles()) {
            final Map<String, TestData> testdata = DataReader.readClassFolder(clazzFile);
            for (final Map.Entry<String, TestData> entry : testdata.entrySet()) {
                cleaner.processTestdata(entry.getValue());
            }
        }
    }
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) File(java.io.File) Map(java.util.Map) Cleaner(de.dagere.peass.measurement.cleaning.Cleaner)

Aggregations

TestData (de.dagere.peass.measurement.statistics.data.TestData)5 File (java.io.File)5 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 XMLDataLoader (de.dagere.kopeme.datastorage.XMLDataLoader)1 Kopemedata (de.dagere.kopeme.generated.Kopemedata)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)1 Cleaner (de.dagere.peass.measurement.cleaning.Cleaner)1 Map (java.util.Map)1 JAXBException (javax.xml.bind.JAXBException)1