Search in sources :

Example 31 with JvmGcBo

use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.

the class JvmGcSamplerTest method gcCalculation_jvmRestarts_uncollectedValues_previousUncollectedValue.

@Test
public void gcCalculation_jvmRestarts_uncollectedValues_previousUncollectedValue() {
    // Given
    long firstAgentStartTimestamp = 10L;
    long secondAgentStartTimestamp = 1000L;
    JvmGcBo previousJvmGcBo = createJvmGcBoForGcTest(firstAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    JvmGcBo uncollectedJvmGcBo1_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount_1 = randomGcCount();
    long firstGcTime_1 = randomGcTime();
    JvmGcBo firstJvmGcBo_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, firstGcCount_1, firstGcTime_1);
    long secondGcCount_1 = randomGcCount() + firstGcCount_1;
    long secondGcTime_1 = randomGcTime() + firstGcTime_1;
    JvmGcBo secondJvmGcBo_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, secondGcCount_1, secondGcTime_1);
    JvmGcBo uncollectedJvmGcBo2_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount_2 = randomGcCount();
    long firstGcTime_2 = randomGcTime();
    JvmGcBo firstJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, firstGcCount_2, firstGcTime_2);
    JvmGcBo uncollectedJvmGcBo1_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long secondGcCount_2 = randomGcCount() + firstGcCount_2;
    long secondGcTime_2 = randomGcTime() + firstGcTime_2;
    JvmGcBo secondJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, secondGcCount_2, secondGcTime_2);
    long thirdGcCount_2 = randomGcCount() + secondGcCount_2;
    long thirdGcTime_2 = randomGcCount() + secondGcTime_2;
    JvmGcBo thirdJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, thirdGcCount_2, thirdGcTime_2);
    JvmGcBo uncollectedJvmGcBo2_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(uncollectedJvmGcBo2_2, thirdJvmGcBo_2, secondJvmGcBo_2, uncollectedJvmGcBo1_2, firstJvmGcBo_2, uncollectedJvmGcBo2_1, secondJvmGcBo_1, firstJvmGcBo_1, uncollectedJvmGcBo1_1);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, previousJvmGcBo);
    // Then
    long gcCountsBeforeJvmRestart = secondGcCount_1 - firstGcCount_1;
    long gcCountsAfterJvmRestart = thirdGcCount_2;
    long gcTimesBeforeJvmRestart = secondGcTime_1 - firstGcTime_1;
    long gcTimesAfterJvmRestart = thirdGcTime_2;
    long expectedGcCount = gcCountsBeforeJvmRestart + gcCountsAfterJvmRestart;
    long expectedGcTime = gcTimesBeforeJvmRestart + gcTimesAfterJvmRestart;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Example 32 with JvmGcBo

use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.

the class JvmGcSamplerTest method createJvmGcBoForGcTest.

private JvmGcBo createJvmGcBoForGcTest(long startTimestamp, long gcOldCount, long gcOldTime) {
    JvmGcBo jvmGcBo = createJvmGcBoForGcTest(gcOldCount, gcOldTime);
    jvmGcBo.setStartTimestamp(startTimestamp);
    return jvmGcBo;
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)

Example 33 with JvmGcBo

use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.

the class JvmGcSamplerTest method gcCalculation_jvmRestarts_uncollectedValues_noPrevious.

@Test
public void gcCalculation_jvmRestarts_uncollectedValues_noPrevious() {
    // Given
    long firstAgentStartTimestamp = 10L;
    long secondAgentStartTimestamp = 1000L;
    JvmGcBo uncollectedJvmGcBo1_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount_1 = randomGcCount();
    long firstGcTime_1 = randomGcTime();
    JvmGcBo firstJvmGcBo_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, firstGcCount_1, firstGcTime_1);
    JvmGcBo uncollectedJvmGcBo2_1 = createJvmGcBoForGcTest(firstAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount_2 = randomGcCount();
    long firstGcTime_2 = randomGcTime();
    JvmGcBo firstJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, firstGcCount_2, firstGcTime_2);
    JvmGcBo uncollectedJvmGcBo1_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long secondGcCount_2 = randomGcCount() + firstGcCount_2;
    long secondGcTime_2 = randomGcTime() + firstGcTime_2;
    JvmGcBo secondJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, secondGcCount_2, secondGcTime_2);
    long thirdGcCount_2 = randomGcCount() + secondGcCount_2;
    long thirdGcTime_2 = randomGcCount() + secondGcTime_2;
    JvmGcBo thirdJvmGcBo_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, thirdGcCount_2, thirdGcTime_2);
    JvmGcBo uncollectedJvmGcBo2_2 = createJvmGcBoForGcTest(secondAgentStartTimestamp, JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(uncollectedJvmGcBo2_2, thirdJvmGcBo_2, secondJvmGcBo_2, uncollectedJvmGcBo1_2, firstJvmGcBo_2, uncollectedJvmGcBo2_1, firstJvmGcBo_1, uncollectedJvmGcBo1_1);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, null);
    // Then
    long gcCountsBeforeJvmRestart = 0L;
    long gcCountsAfterJvmRestart = thirdGcCount_2;
    long gcTimesBeforeJvmRestart = 0L;
    long gcTimesAfterJvmRestart = thirdGcTime_2;
    long expectedGcCount = gcCountsBeforeJvmRestart + gcCountsAfterJvmRestart;
    long expectedGcTime = gcTimesBeforeJvmRestart + gcTimesAfterJvmRestart;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Example 34 with JvmGcBo

use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.

the class JvmGcSamplerTest method gcCalculation_uncollectedValues_previousUncollectedValue.

@Test
public void gcCalculation_uncollectedValues_previousUncollectedValue() {
    // Given
    JvmGcBo previousJvmGcBo = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    JvmGcBo uncollectedJvmGcBo1 = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long firstGcCount = randomGcCount();
    long firstGcTime = randomGcTime();
    JvmGcBo firstJvmGcBo = createJvmGcBoForGcTest(firstGcCount, firstGcTime);
    JvmGcBo uncollectedJvmGcBo2 = createJvmGcBoForGcTest(JvmGcBo.UNCOLLECTED_VALUE, JvmGcBo.UNCOLLECTED_VALUE);
    long secondGcCount = randomGcCount() + firstGcCount;
    long secondGcTime = randomGcTime() + firstGcTime;
    JvmGcBo secondJvmGcBo = createJvmGcBoForGcTest(secondGcCount, secondGcTime);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(secondJvmGcBo, uncollectedJvmGcBo2, firstJvmGcBo, uncollectedJvmGcBo1);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, previousJvmGcBo);
    // Then
    long expectedGcCount = secondGcCount - firstGcCount;
    long expectedGcTime = secondGcTime - firstGcTime;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Example 35 with JvmGcBo

use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.

the class JvmGcSamplerTest method gcCalculation_multipleDataPoints.

@Test
public void gcCalculation_multipleDataPoints() {
    // Given
    long previousGcCount = randomGcCount();
    long previousGcTime = randomGcTime();
    JvmGcBo previousJvmGcBo = createJvmGcBoForGcTest(previousGcCount, previousGcTime);
    long firstGcCount = randomGcCount() + previousGcCount;
    long firstGcTime = randomGcTime() + previousGcTime;
    JvmGcBo firstJvmGcBo = createJvmGcBoForGcTest(firstGcCount, firstGcTime);
    long secondGcCount = randomGcCount() + firstGcCount;
    long secondGcTime = randomGcTime() + firstGcTime;
    JvmGcBo secondJvmGcBo = createJvmGcBoForGcTest(secondGcCount, secondGcTime);
    // must be in descending order
    List<JvmGcBo> jvmGcBos = Arrays.asList(secondJvmGcBo, firstJvmGcBo);
    // When
    SampledJvmGc sampledJvmGc = sampler.sampleDataPoints(0, System.currentTimeMillis(), jvmGcBos, previousJvmGcBo);
    // Then
    long expectedGcCount = secondGcCount - previousGcCount;
    long expectedGcTime = secondGcTime - previousGcTime;
    long actualGcCount = sampledJvmGc.getGcOldCount().getSumYVal();
    long actualGcTime = sampledJvmGc.getGcOldTime().getSumYVal();
    Assert.assertEquals(expectedGcCount, actualGcCount);
    Assert.assertEquals(expectedGcTime, actualGcTime);
}
Also used : JvmGcBo(com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo) SampledJvmGc(com.navercorp.pinpoint.web.vo.stat.SampledJvmGc) Test(org.junit.Test)

Aggregations

JvmGcBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo)39 SampledJvmGc (com.navercorp.pinpoint.web.vo.stat.SampledJvmGc)15 Test (org.junit.Test)13 CpuLoadBo (com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo)10 Range (com.navercorp.pinpoint.web.vo.Range)10 ArrayList (java.util.ArrayList)7 ApplicationIndexDao (com.navercorp.pinpoint.web.dao.ApplicationIndexDao)6 LinkedList (java.util.LinkedList)6 List (java.util.List)6 BeforeClass (org.junit.BeforeClass)6 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)4 JvmGcType (com.navercorp.pinpoint.common.server.bo.JvmGcType)3 AgentStatHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder)2 BitCountingHeaderDecoder (com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder)2 JvmGcCodecV2 (com.navercorp.pinpoint.common.server.bo.codec.stat.v2.JvmGcCodecV2)2 ActiveTraceBo (com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo)2 DataSourceBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo)2 DataSourceListBo (com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo)2 JvmGcDetailedBo (com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo)2 TransactionBo (com.navercorp.pinpoint.common.server.bo.stat.TransactionBo)2