use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo in project pinpoint by naver.
the class JvmGcDetailedCodecV1 method decodeValues.
@Override
public List<JvmGcDetailedBo> decodeValues(Buffer valueBuffer, AgentStatDecodingContext decodingContext) {
final String agentId = decodingContext.getAgentId();
final long baseTimestamp = decodingContext.getBaseTimestamp();
final long timestampDelta = decodingContext.getTimestampDelta();
final long initialTimestamp = baseTimestamp + timestampDelta;
int numValues = valueBuffer.readVInt();
List<Long> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
// decode headers
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
EncodingStrategy<Long> gcNewCountEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> gcNewTimeEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> codeCacheUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> newGenUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> oldGenUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> survivorSpaceUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> permGenUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
EncodingStrategy<Long> metaspaceUsedEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode());
// decode values
List<Long> gcNewCounts = this.codec.decodeValues(valueBuffer, gcNewCountEncodingStrategy, numValues);
List<Long> gcNewTimes = this.codec.decodeValues(valueBuffer, gcNewTimeEncodingStrategy, numValues);
List<Long> codeCacheUseds = this.codec.decodeValues(valueBuffer, codeCacheUsedEncodingStrategy, numValues);
List<Long> newGenUseds = this.codec.decodeValues(valueBuffer, newGenUsedEncodingStrategy, numValues);
List<Long> oldGenUseds = this.codec.decodeValues(valueBuffer, oldGenUsedEncodingStrategy, numValues);
List<Long> survivorSpaceUseds = this.codec.decodeValues(valueBuffer, survivorSpaceUsedEncodingStrategy, numValues);
List<Long> permGenUseds = this.codec.decodeValues(valueBuffer, permGenUsedEncodingStrategy, numValues);
List<Long> metaspaceUseds = this.codec.decodeValues(valueBuffer, metaspaceUsedEncodingStrategy, numValues);
List<JvmGcDetailedBo> jvmGcDetailedBos = new ArrayList<JvmGcDetailedBo>(numValues);
for (int i = 0; i < numValues; ++i) {
JvmGcDetailedBo jvmGcDetailedBo = new JvmGcDetailedBo();
jvmGcDetailedBo.setAgentId(agentId);
jvmGcDetailedBo.setTimestamp(timestamps.get(i));
jvmGcDetailedBo.setGcNewCount(gcNewCounts.get(i));
jvmGcDetailedBo.setGcNewTime(gcNewTimes.get(i));
jvmGcDetailedBo.setCodeCacheUsed(AgentStatUtils.convertLongToDouble(codeCacheUseds.get(i)));
jvmGcDetailedBo.setNewGenUsed(AgentStatUtils.convertLongToDouble(newGenUseds.get(i)));
jvmGcDetailedBo.setOldGenUsed(AgentStatUtils.convertLongToDouble(oldGenUseds.get(i)));
jvmGcDetailedBo.setSurvivorSpaceUsed(AgentStatUtils.convertLongToDouble(survivorSpaceUseds.get(i)));
jvmGcDetailedBo.setPermGenUsed(AgentStatUtils.convertLongToDouble(permGenUseds.get(i)));
jvmGcDetailedBo.setMetaspaceUsed(AgentStatUtils.convertLongToDouble(metaspaceUseds.get(i)));
jvmGcDetailedBos.add(jvmGcDetailedBo);
}
return jvmGcDetailedBos;
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo in project pinpoint by naver.
the class JvmGcDetailedCodecV1 method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JvmGcDetailedBo> jvmGcDetailedBos) {
if (CollectionUtils.isEmpty(jvmGcDetailedBos)) {
throw new IllegalArgumentException("jvmGcDetailedBos must not be empty");
}
final int numValues = jvmGcDetailedBos.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<Long>(numValues);
UnsignedLongEncodingStrategy.Analyzer.Builder gcNewCountAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder gcNewTimeAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder codeCacheUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder newGenUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder oldGenUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder survivorSpaceUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder permGenUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
UnsignedLongEncodingStrategy.Analyzer.Builder metaspaceUsedStrategyAnalyzer = new UnsignedLongEncodingStrategy.Analyzer.Builder();
for (JvmGcDetailedBo jvmGcDetailedBo : jvmGcDetailedBos) {
timestamps.add(jvmGcDetailedBo.getTimestamp());
gcNewCountAnalyzerBuilder.addValue(jvmGcDetailedBo.getGcNewCount());
gcNewTimeAnalyzerBuilder.addValue(jvmGcDetailedBo.getGcNewTime());
codeCacheUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getCodeCacheUsed()));
newGenUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getNewGenUsed()));
oldGenUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getOldGenUsed()));
survivorSpaceUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getSurvivorSpaceUsed()));
permGenUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getPermGenUsed()));
metaspaceUsedStrategyAnalyzer.addValue(AgentStatUtils.convertDoubleToLong(jvmGcDetailedBo.getMetaspaceUsed()));
}
this.codec.encodeTimestamps(valueBuffer, timestamps);
this.encodeDataPoints(valueBuffer, gcNewCountAnalyzerBuilder.build(), gcNewTimeAnalyzerBuilder.build(), codeCacheUsedStrategyAnalyzer.build(), newGenUsedStrategyAnalyzer.build(), oldGenUsedStrategyAnalyzer.build(), survivorSpaceUsedStrategyAnalyzer.build(), permGenUsedStrategyAnalyzer.build(), metaspaceUsedStrategyAnalyzer.build());
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo in project pinpoint by naver.
the class TestAgentStatFactory method createJvmGcDetailedBos.
public static List<JvmGcDetailedBo> createJvmGcDetailedBos(String agentId, long startTimestamp, long initialTimestamp, int numValues) {
List<JvmGcDetailedBo> jvmGcDetailedBos = new ArrayList<JvmGcDetailedBo>(numValues);
List<Long> startTimestamps = createStartTimestamps(startTimestamp, numValues);
List<Long> timestamps = createTimestamps(initialTimestamp, numValues);
List<Long> gcNewCounts = TestAgentStatDataPointFactory.LONG.createIncreasingValues(0L, 10000000L, 10L, 1000L, numValues);
List<Long> gcNewTimes = TestAgentStatDataPointFactory.LONG.createIncreasingValues(0L, 100L, 1L, 50L, numValues);
List<Double> codeCacheUseds = createRandomPercentageValues(numValues);
List<Double> newGenUseds = createRandomPercentageValues(numValues);
List<Double> oldGenUseds = createRandomPercentageValues(numValues);
List<Double> survivorSpaceUseds = createRandomPercentageValues(numValues);
List<Double> permGenUseds = createRandomPercentageValues(numValues);
List<Double> metaspaceUseds = createRandomPercentageValues(numValues);
for (int i = 0; i < numValues; ++i) {
JvmGcDetailedBo jvmGcDetailedBo = new JvmGcDetailedBo();
jvmGcDetailedBo.setAgentId(agentId);
jvmGcDetailedBo.setStartTimestamp(startTimestamps.get(i));
jvmGcDetailedBo.setTimestamp(timestamps.get(i));
jvmGcDetailedBo.setGcNewCount(gcNewCounts.get(i));
jvmGcDetailedBo.setGcNewTime(gcNewTimes.get(i));
jvmGcDetailedBo.setCodeCacheUsed(codeCacheUseds.get(i));
jvmGcDetailedBo.setNewGenUsed(newGenUseds.get(i));
jvmGcDetailedBo.setOldGenUsed(oldGenUseds.get(i));
jvmGcDetailedBo.setSurvivorSpaceUsed(survivorSpaceUseds.get(i));
jvmGcDetailedBo.setPermGenUsed(permGenUseds.get(i));
jvmGcDetailedBo.setMetaspaceUsed(metaspaceUseds.get(i));
jvmGcDetailedBos.add(jvmGcDetailedBo);
}
return jvmGcDetailedBos;
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo in project pinpoint by naver.
the class HbaseSampledJvmGcDetailedDaoV2 method getSampledAgentStatList.
@Override
public List<SampledJvmGcDetailed> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
long scanFrom = timeWindow.getWindowRange().getFrom();
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
Range range = new Range(scanFrom, scanTo);
AgentStatMapperV2<JvmGcDetailedBo> mapper = operations.createRowMapper(jvmGcDetailedDecoder, range);
SampledAgentStatResultExtractor<JvmGcDetailedBo, SampledJvmGcDetailed> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, jvmGcDetailedSampler);
return operations.getSampledAgentStatList(AgentStatType.JVM_GC_DETAILED, resultExtractor, agentId, range);
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo in project pinpoint by naver.
the class JvmGcDetailedSampler method sampleDataPoints.
@Override
public SampledJvmGcDetailed sampleDataPoints(int timeWindowIndex, long timestamp, List<JvmGcDetailedBo> dataPoints, JvmGcDetailedBo previousDataPoint) {
List<Long> gcNewCounts = new ArrayList<>(dataPoints.size());
List<Long> gcNewTimes = new ArrayList<>(dataPoints.size());
List<Double> codeCacheUseds = new ArrayList<>(dataPoints.size());
List<Double> newGenUseds = new ArrayList<>(dataPoints.size());
List<Double> oldGenUseds = new ArrayList<>(dataPoints.size());
List<Double> survivorSpaceUseds = new ArrayList<>(dataPoints.size());
List<Double> permGenUseds = new ArrayList<>(dataPoints.size());
List<Double> metaspaceUseds = new ArrayList<>(dataPoints.size());
for (JvmGcDetailedBo jvmGcDetailedBo : dataPoints) {
if (jvmGcDetailedBo.getGcNewCount() != JvmGcDetailedBo.UNCOLLECTED_VALUE) {
gcNewCounts.add(jvmGcDetailedBo.getGcNewCount());
}
if (jvmGcDetailedBo.getGcNewTime() != JvmGcDetailedBo.UNCOLLECTED_VALUE) {
gcNewTimes.add(jvmGcDetailedBo.getGcNewTime());
}
if (jvmGcDetailedBo.getCodeCacheUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
codeCacheUseds.add(jvmGcDetailedBo.getCodeCacheUsed() * 100);
}
if (jvmGcDetailedBo.getNewGenUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
newGenUseds.add(jvmGcDetailedBo.getNewGenUsed() * 100);
}
if (jvmGcDetailedBo.getOldGenUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
oldGenUseds.add(jvmGcDetailedBo.getOldGenUsed() * 100);
}
if (jvmGcDetailedBo.getSurvivorSpaceUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
survivorSpaceUseds.add(jvmGcDetailedBo.getSurvivorSpaceUsed() * 100);
}
if (jvmGcDetailedBo.getPermGenUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
permGenUseds.add(jvmGcDetailedBo.getPermGenUsed() * 100);
}
if (jvmGcDetailedBo.getMetaspaceUsed() != JvmGcDetailedBo.UNCOLLECTED_PERCENTAGE) {
metaspaceUseds.add(jvmGcDetailedBo.getMetaspaceUsed() * 100);
}
}
SampledJvmGcDetailed sampledJvmGcDetailed = new SampledJvmGcDetailed();
sampledJvmGcDetailed.setGcNewCount(createLongPoint(timestamp, gcNewCounts));
sampledJvmGcDetailed.setGcNewTime(createLongPoint(timestamp, gcNewTimes));
sampledJvmGcDetailed.setCodeCacheUsed(createDoublePoint(timestamp, codeCacheUseds));
sampledJvmGcDetailed.setNewGenUsed(createDoublePoint(timestamp, newGenUseds));
sampledJvmGcDetailed.setOldGenUsed(createDoublePoint(timestamp, oldGenUseds));
sampledJvmGcDetailed.setSurvivorSpaceUsed(createDoublePoint(timestamp, survivorSpaceUseds));
sampledJvmGcDetailed.setPermGenUsed(createDoublePoint(timestamp, permGenUseds));
sampledJvmGcDetailed.setMetaspaceUsed(createDoublePoint(timestamp, metaspaceUseds));
return sampledJvmGcDetailed;
}
Aggregations