Search in sources :

Example 26 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource in project GCViewer by chewiebug.

the class TestDataReaderFacade method testLoadModel_forSeries.

@Test
public void testLoadModel_forSeries() throws IOException, DataReaderException {
    GCResource file1 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part1.txt").getPath());
    GCResource file2 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part2.txt").getPath());
    GCResource file3 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part3.txt").getPath());
    GCResource file4 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part4.txt").getPath());
    GCResource file5 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part5.txt").getPath());
    GCResource file6 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part6.txt").getPath());
    GCResource file7 = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-Part7.txt").getPath());
    GCResource expectedResult = new GcResourceFile(UnittestHelper.getResource(UnittestHelper.FOLDER_OPENJDK, "SampleSun1_8_0Series-ManuallyMerged.txt").getPath());
    GCModel expectedModel = dataReaderFacade.loadModel(expectedResult);
    List<GCResource> resources = new ArrayList<>();
    resources.add(file4);
    resources.add(file3);
    resources.add(file6);
    resources.add(file1);
    resources.add(file7);
    resources.add(file2);
    resources.add(file5);
    GcResourceSeries series = new GcResourceSeries(resources);
    GCModel result = dataReaderFacade.loadModelFromSeries(series);
    assertThat(result.toString(), is(expectedModel.toString()));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) ArrayList(java.util.ArrayList) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) Test(org.junit.Test)

Example 27 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource in project GCViewer by chewiebug.

the class TestDataReaderFacade method loadModelStringFileExistsNoWarnings.

/**
     * Tests {@link DataReaderFacade#loadModel(GCResource)}
     * with filename that does exist.
     */
@Test
public void loadModelStringFileExistsNoWarnings() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile(PARENT_PATH + SAMPLE_GCLOG_SUN1_6_0);
    gcResource.getLogger().addHandler(handler);
    final GCModel model = dataReaderFacade.loadModel(gcResource);
    assertEquals("has no errors", 0, handler.getCount());
    assertNotNull("Model returned", model);
    assertNotNull("Model returned contains URL", model.getURL());
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 28 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource in project GCViewer by chewiebug.

the class TestDataReaderIBM_J9_R28 method testConcurrentMinimal.

@Test
public void testConcurrentMinimal() throws Exception {
    // there are minimal concurrent blocks, that don't contain any information, that the parser can use (at least, at the moment)
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R28_concurrentMinimal.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(0));
    assertThat("number of errors", handler.getCount(), is(0));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Example 29 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource in project GCViewer by chewiebug.

the class TestDataReaderIBM_J9_R28 method testConcurrentCollection.

@Test
@Ignore
public void testConcurrentCollection() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R28_concurrent_collection.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(1));
    assertThat("duration", model.get(0).getPause(), closeTo(1.182375, 0.00000001));
    assertThat("number of errors", handler.getCount(), is(0));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 30 with GCResource

use of com.tagtraum.perf.gcviewer.model.GCResource in project GCViewer by chewiebug.

the class TestDataReaderIBM_J9_R28 method testSysGlobal.

@Test
public void testSysGlobal() throws Exception {
    TestLogHandler handler = new TestLogHandler();
    handler.setLevel(Level.WARNING);
    GCResource gcResource = new GcResourceFile("SampleIBMJ9_R28_sys_global.txt");
    gcResource.getLogger().addHandler(handler);
    DataReader reader = getDataReader(gcResource);
    GCModel model = reader.read();
    assertThat("model size", model.size(), is(1));
    GCEvent event = (GCEvent) model.get(0);
    assertThat("pause", event.getPause(), closeTo(0.097756, 0.0000001));
    assertThat("type", event.getTypeAsString(), equalTo("sys explicit global; nursery; tenure"));
    assertThat("number of errors", handler.getCount(), is(0));
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCEvent(com.tagtraum.perf.gcviewer.model.GCEvent) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) Test(org.junit.Test)

Aggregations

GCResource (com.tagtraum.perf.gcviewer.model.GCResource)65 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)55 Test (org.junit.Test)54 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)40 ByteArrayInputStream (java.io.ByteArrayInputStream)15 GCEvent (com.tagtraum.perf.gcviewer.model.GCEvent)13 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)10 InputStream (java.io.InputStream)9 ArrayList (java.util.ArrayList)8 File (java.io.File)4 GCModelLoader (com.tagtraum.perf.gcviewer.ctrl.GCModelLoader)2 LogRecord (java.util.logging.LogRecord)2 GCModelLoaderGroupTracker (com.tagtraum.perf.gcviewer.ctrl.GCModelLoaderGroupTracker)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1