Search in sources :

Example 1 with DoubleData

use of com.tagtraum.perf.gcviewer.math.DoubleData in project GCViewer by chewiebug.

the class GCModel method getDoubleData.

private DoubleData getDoubleData(String key, Map<String, DoubleData> eventMap) {
    DoubleData data = eventMap.get(key);
    if (data == null) {
        data = new DoubleData();
        eventMap.put(key, data);
    }
    return data;
}
Also used : DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData)

Example 2 with DoubleData

use of com.tagtraum.perf.gcviewer.math.DoubleData in project GCViewer by chewiebug.

the class GCModel method add.

public void add(AbstractGCEvent<?> abstractEvent) {
    makeSureHasTimeStamp(abstractEvent);
    allEvents.add(abstractEvent);
    if (abstractEvent.isStopTheWorld()) {
        // totalPause must not be added here yet, because in case of vmOperationEvents, the
        // pause might be adjusted
        stopTheWorldEvents.add(abstractEvent);
    }
    if (abstractEvent instanceof ConcurrentGCEvent) {
        ConcurrentGCEvent concEvent = (ConcurrentGCEvent) abstractEvent;
        concurrentGCEvents.add(concEvent);
        DoubleData pauses = getDoubleData(concEvent.getExtendedType().getName(), concurrentGcEventPauses);
        pauses.add(concEvent.getPause());
    } else if (abstractEvent instanceof GCEvent) {
        // collect statistics about all stop the world events
        GCEvent event = (GCEvent) abstractEvent;
        updateHeapSizes(event);
        updateGcPauseInterval(event);
        updatePromotion(event);
        if (event.isInitialMark()) {
            updateInitiatingOccupancyFraction(event);
        }
        if (size() > 1 && allEvents.get(allEvents.size() - 2).isConcurrentCollectionEnd()) {
            updatePostConcurrentCycleUsedSizes(event);
        }
        freedMemory += event.getPreUsed() - event.getPostUsed();
        if (!event.isFull()) {
            // make a difference between stop the world events, which only collect from some generations...
            DoubleData pauses = getDoubleData(event.getTypeAsString(), gcEventPauses);
            pauses.add(event.getPause());
            gcEvents.add(event);
            postGCUsedMemory.add(event.getPostUsed());
            freedMemoryByGC.add(event.getPreUsed() - event.getPostUsed());
            currentNoFullGCEvents.add(event);
            currentPostGCSlope.addPoint(event.getTimestamp(), event.getPostUsed());
            currentRelativePostGCIncrease.addPoint(currentRelativePostGCIncrease.getPointCount(), event.getPostUsed());
            gcPause.add(event.getPause());
        } else {
            // ... as opposed to all generations
            DoubleData pauses = getDoubleData(event.getTypeAsString(), fullGcEventPauses);
            pauses.add(event.getPause());
            updateFullGcPauseInterval(event);
            fullGCEvents.add(event);
            postFullGCUsedHeap.add(event.getPostUsed());
            int freed = event.getPreUsed() - event.getPostUsed();
            freedMemoryByFullGC.add(freed);
            fullGCPause.add(event.getPause());
            postFullGCSlope.addPoint(event.getTimestamp(), event.getPostUsed());
            relativePostFullGCIncrease.addPoint(relativePostFullGCIncrease.getPointCount(), event.getPostUsed());
            // process no full-gc run data
            if (currentPostGCSlope.hasPoints()) {
                // make sure we have at least _two_ data points
                if (currentPostGCSlope.isLine()) {
                    postGCSlope.add(currentPostGCSlope.slope(), currentPostGCSlope.getPointCount());
                    relativePostGCIncrease.add(currentRelativePostGCIncrease.slope(), currentRelativePostGCIncrease.getPointCount());
                }
                currentPostGCSlope.reset();
                currentRelativePostGCIncrease.reset();
            }
        }
    } else if (abstractEvent instanceof VmOperationEvent) {
        adjustPause((VmOperationEvent) abstractEvent);
        if (abstractEvent.getTimestamp() < 0.000001) {
            setTimeStamp((VmOperationEvent) abstractEvent);
        }
        vmOperationPause.add(abstractEvent.getPause());
        vmOperationEvents.add(abstractEvent);
        DoubleData vmOpPauses = getDoubleData(abstractEvent.getTypeAsString(), vmOperationEventPauses);
        vmOpPauses.add(abstractEvent.getPause());
    }
    if (size() == 1 || (size() > 1 && abstractEvent.getTimestamp() > 0.0)) {
        // timestamp == 0 is only valid, if it is the first event.
        // sometimes, no timestamp is present, because the line is mixed -> don't count these here
        firstPauseTimeStamp = Math.min(firstPauseTimeStamp, abstractEvent.getTimestamp());
    }
    lastPauseTimeStamp = Math.max(lastPauseTimeStamp, abstractEvent.getTimestamp());
    if (abstractEvent.isStopTheWorld()) {
        // add to total pause here, because then adjusted VmOperationEvents are added correctly
        // as well
        totalPause.add(abstractEvent.getPause());
    }
}
Also used : DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData)

Example 3 with DoubleData

use of com.tagtraum.perf.gcviewer.math.DoubleData in project GCViewer by chewiebug.

the class TestDataReaderJRockit1_5_0 method testGenPar.

@Test
public void testGenPar() throws Exception {
    DataReader reader = getDataReader1_5(new GcResourceFile("SampleJRockit1_5_12_genpar.txt"));
    GCModel model = reader.read();
    assertEquals("count", 17, model.size());
    // 2 types of events excpected: "GC" and "parallel nursery GC"
    Map<String, DoubleData> gcEventPauses = model.getGcEventPauses();
    assertEquals("2 types of events found", 2, gcEventPauses.entrySet().size());
}
Also used : GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData) Test(org.junit.Test)

Example 4 with DoubleData

use of com.tagtraum.perf.gcviewer.math.DoubleData in project GCViewer by chewiebug.

the class TestGCModel method fullGcInterval.

@Test
public void fullGcInterval() throws Exception {
    GCModel gcModel = new GCModel();
    gcModel.add(new GCEvent(1.0, 10, 5, 100, 0.1, Type.GC));
    gcModel.add(new GCEvent(2.0, 10, 5, 100, 0.1, Type.GC));
    gcModel.add(new GCEvent(3.0, 10, 5, 100, 0.1, Type.FULL_GC));
    gcModel.add(new GCEvent(4.0, 10, 5, 100, 0.1, Type.GC));
    gcModel.add(new GCEvent(5.0, 10, 5, 100, 0.1, Type.GC));
    gcModel.add(new GCEvent(6.0, 10, 5, 100, 0.1, Type.FULL_GC));
    gcModel.add(new GCEvent(7.0, 10, 5, 100, 0.1, Type.FULL_GC));
    DoubleData fullGcInterval = gcModel.getFullGCPauseInterval();
    assertThat("max interval", fullGcInterval.getMax(), closeTo(3, 0.001));
    assertThat("min interval", fullGcInterval.getMin(), closeTo(1, 0.001));
}
Also used : DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData) Test(org.junit.Test)

Example 5 with DoubleData

use of com.tagtraum.perf.gcviewer.math.DoubleData in project GCViewer by chewiebug.

the class ModelChartImplTest method shouldShowOrNotDateStampAccordingToModelAndSettings.

@Theory
public void shouldShowOrNotDateStampAccordingToModelAndSettings(TestCase testCase) throws Exception {
    //given
    ModelChartImpl modelChart = new ModelChartImpl();
    GCPreferences preferences = new GCPreferences();
    GCModel gcModel = Mockito.mock(GCModel.class);
    Mockito.when(gcModel.hasDateStamp()).thenReturn(testCase.hasDateStamp());
    Mockito.when(gcModel.getFirstDateStamp()).thenReturn(ZonedDateTime.now());
    Mockito.when(gcModel.getPause()).thenReturn(new DoubleData());
    preferences.setShowDateStamp(testCase.isShowDateStamp());
    //when
    modelChart.setModel(gcModel, preferences);
    //then
    assertThat(modelChart.isShowDateStamp(), equalTo(testCase.isExpectedShowDateStamp()));
}
Also used : GCPreferences(com.tagtraum.perf.gcviewer.view.model.GCPreferences) ModelChartImpl(com.tagtraum.perf.gcviewer.view.ModelChartImpl) GCModel(com.tagtraum.perf.gcviewer.model.GCModel) DoubleData(com.tagtraum.perf.gcviewer.math.DoubleData) Theory(org.junit.experimental.theories.Theory)

Aggregations

DoubleData (com.tagtraum.perf.gcviewer.math.DoubleData)6 Test (org.junit.Test)3 GCModel (com.tagtraum.perf.gcviewer.model.GCModel)2 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)1 ModelChartImpl (com.tagtraum.perf.gcviewer.view.ModelChartImpl)1 GCPreferences (com.tagtraum.perf.gcviewer.view.model.GCPreferences)1 Theory (org.junit.experimental.theories.Theory)1