Search in sources :

Example 1 with AgentStatCpuLoadBo

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

the class AgentStatCpuLoadBoTest method testByteArrayConversion.

@Test
public void testByteArrayConversion() {
    // Given
    final AgentStatCpuLoadBo testBo = createTestBo(0.22871734201908112D, 0.23790152370929718D);
    // When
    final byte[] serializedBo = testBo.writeValue();
    final AgentStatCpuLoadBo deserializedBo = new AgentStatCpuLoadBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo.getAgentId(), deserializedBo.getAgentId());
    assertEquals(testBo.getStartTimestamp(), deserializedBo.getStartTimestamp());
    assertEquals(testBo.getTimestamp(), deserializedBo.getTimestamp());
    assertEquals(testBo.getJvmCpuLoad(), deserializedBo.getJvmCpuLoad(), DELTA);
    assertEquals(testBo.getSystemCpuLoad(), deserializedBo.getSystemCpuLoad(), DELTA);
}
Also used : AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo) Test(org.junit.Test)

Example 2 with AgentStatCpuLoadBo

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

the class AgentStatCpuLoadBoTest method testByteArrayConversionEdges.

@Test
public void testByteArrayConversionEdges() {
    // Given
    final AgentStatCpuLoadBo testBo = createTestBo(Double.MIN_VALUE, Double.MAX_VALUE);
    // When
    final byte[] serializedBo = testBo.writeValue();
    final AgentStatCpuLoadBo deserializedBo = new AgentStatCpuLoadBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo.getAgentId(), deserializedBo.getAgentId());
    assertEquals(testBo.getStartTimestamp(), deserializedBo.getStartTimestamp());
    assertEquals(testBo.getTimestamp(), deserializedBo.getTimestamp());
    assertEquals(testBo.getJvmCpuLoad(), deserializedBo.getJvmCpuLoad(), DELTA);
    assertEquals(testBo.getSystemCpuLoad(), deserializedBo.getSystemCpuLoad(), DELTA);
}
Also used : AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo) Test(org.junit.Test)

Example 3 with AgentStatCpuLoadBo

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

the class LegacyAgentStatMapperTest method createResultForLegacy_serialized_BOs.

private Result createResultForLegacy_serialized_BOs() {
    final AgentStatMemoryGcBo.Builder jvmGcBuilder = new AgentStatMemoryGcBo.Builder(AGENT_ID, 0L, TIMESTAMP);
    jvmGcBuilder.gcType(GC_TYPE.name());
    jvmGcBuilder.jvmGcOldCount(GC_OLD_COUNT);
    jvmGcBuilder.jvmGcOldTime(GC_OLD_TIME);
    jvmGcBuilder.jvmMemoryHeapUsed(HEAP_USED);
    jvmGcBuilder.jvmMemoryHeapMax(HEAP_MAX);
    jvmGcBuilder.jvmMemoryNonHeapUsed(NON_HEAP_USED);
    jvmGcBuilder.jvmMemoryNonHeapMax(NON_HEAP_MAX);
    final AgentStatCpuLoadBo.Builder cpuLoadBuilder = new AgentStatCpuLoadBo.Builder(AGENT_ID, 0L, TIMESTAMP);
    cpuLoadBuilder.jvmCpuLoad(JVM_CPU_USAGE);
    cpuLoadBuilder.systemCpuLoad(SYS_CPU_USAGE);
    final AgentStatMemoryGcBo jvmGc = jvmGcBuilder.build();
    final AgentStatCpuLoadBo cpuLoad = cpuLoadBuilder.build();
    final Cell jvmGcCell = createCell(AGENT_STAT_CF_STATISTICS_MEMORY_GC, jvmGc.writeValue());
    final Cell cpuLoadCell = createCell(AGENT_STAT_CF_STATISTICS_CPU_LOAD, cpuLoad.writeValue());
    return Result.create(Arrays.asList(jvmGcCell, cpuLoadCell));
}
Also used : AgentStatMemoryGcBo(com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo) AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo) Cell(org.apache.hadoop.hbase.Cell)

Example 4 with AgentStatCpuLoadBo

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

the class AgentStatCpuLoadBoTest method testByteArrayConversionInfiniteValues.

@Test
public void testByteArrayConversionInfiniteValues() {
    // Given
    final AgentStatCpuLoadBo testBo = createTestBo(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY);
    // When
    final byte[] serializedBo = testBo.writeValue();
    final AgentStatCpuLoadBo deserializedBo = new AgentStatCpuLoadBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo.getAgentId(), deserializedBo.getAgentId());
    assertEquals(testBo.getStartTimestamp(), deserializedBo.getStartTimestamp());
    assertEquals(testBo.getTimestamp(), deserializedBo.getTimestamp());
    assertEquals(testBo.getJvmCpuLoad(), deserializedBo.getJvmCpuLoad(), DELTA);
    assertEquals(testBo.getSystemCpuLoad(), deserializedBo.getSystemCpuLoad(), DELTA);
}
Also used : AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo) Test(org.junit.Test)

Example 5 with AgentStatCpuLoadBo

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

the class AgentStatCpuLoadBoTest method testByteArrayConversionNanValues.

@Test
public void testByteArrayConversionNanValues() {
    // Given
    final AgentStatCpuLoadBo testBo = createTestBo(Double.NaN, Double.NaN);
    // When
    final byte[] serializedBo = testBo.writeValue();
    final AgentStatCpuLoadBo deserializedBo = new AgentStatCpuLoadBo.Builder(serializedBo).build();
    // Then
    assertEquals(testBo.getAgentId(), deserializedBo.getAgentId());
    assertEquals(testBo.getStartTimestamp(), deserializedBo.getStartTimestamp());
    assertEquals(testBo.getTimestamp(), deserializedBo.getTimestamp());
    assertEquals(testBo.getJvmCpuLoad(), deserializedBo.getJvmCpuLoad(), DELTA);
    assertEquals(testBo.getSystemCpuLoad(), deserializedBo.getSystemCpuLoad(), DELTA);
}
Also used : AgentStatCpuLoadBo(com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo) Test(org.junit.Test)

Aggregations

AgentStatCpuLoadBo (com.navercorp.pinpoint.common.server.bo.AgentStatCpuLoadBo)6 Test (org.junit.Test)4 AgentStatMemoryGcBo (com.navercorp.pinpoint.common.server.bo.AgentStatMemoryGcBo)2 TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)1 AgentStat (com.navercorp.pinpoint.web.vo.AgentStat)1 ArrayList (java.util.ArrayList)1 Cell (org.apache.hadoop.hbase.Cell)1