use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.
the class JvmGcCodecV1 method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JvmGcBo> jvmGcBos) {
if (CollectionUtils.isEmpty(jvmGcBos)) {
throw new IllegalArgumentException("jvmGcBos must not be empty");
}
final int gcTypeCode = jvmGcBos.get(0).getGcType().getTypeCode();
valueBuffer.putVInt(gcTypeCode);
final int numValues = jvmGcBos.size();
valueBuffer.putVInt(numValues);
List<Long> timestamps = new ArrayList<>(numValues);
JvmGcCodecV2.JvmGcCodecEncoder encoder = new JvmGcCodecV2.JvmGcCodecEncoder(codec);
for (JvmGcBo jvmGcBo : jvmGcBos) {
timestamps.add(jvmGcBo.getTimestamp());
encoder.addValue(jvmGcBo);
}
this.codec.encodeTimestamps(valueBuffer, timestamps);
encoder.encode(valueBuffer);
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.
the class JvmGcCodecV2 method encodeValues.
@Override
public void encodeValues(Buffer valueBuffer, List<JvmGcBo> jvmGcBos) {
if (CollectionUtils.isEmpty(jvmGcBos)) {
throw new IllegalArgumentException("jvmGcBos must not be empty");
}
final int gcTypeCode = jvmGcBos.get(0).getGcType().getTypeCode();
valueBuffer.putVInt(gcTypeCode);
final int numValues = jvmGcBos.size();
valueBuffer.putVInt(numValues);
List<Long> startTimestamps = new ArrayList<>(numValues);
List<Long> timestamps = new ArrayList<>(numValues);
JvmGcCodecEncoder jvmGcCodecEncoder = new JvmGcCodecEncoder(codec);
for (JvmGcBo jvmGcBo : jvmGcBos) {
startTimestamps.add(jvmGcBo.getStartTimestamp());
timestamps.add(jvmGcBo.getTimestamp());
jvmGcCodecEncoder.addValue(jvmGcBo);
}
this.codec.encodeValues(valueBuffer, UnsignedLongEncodingStrategy.REPEAT_COUNT, startTimestamps);
this.codec.encodeTimestamps(valueBuffer, timestamps);
jvmGcCodecEncoder.encode(valueBuffer);
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.
the class JvmGcCodecV2 method decodeValues.
@Override
public List<JvmGcBo> 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;
final JvmGcType gcType = JvmGcType.getTypeByCode(valueBuffer.readVInt());
int numValues = valueBuffer.readVInt();
List<Long> startTimestamps = this.codec.decodeValues(valueBuffer, UnsignedLongEncodingStrategy.REPEAT_COUNT, numValues);
List<Long> timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues);
// decode headers
final byte[] header = valueBuffer.readPrefixedBytes();
AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header);
JvmGcCodecDecoder decoder = new JvmGcCodecDecoder(codec);
decoder.decode(valueBuffer, headerDecoder, numValues);
List<JvmGcBo> jvmGcBos = new ArrayList<>(numValues);
for (int i = 0; i < numValues; i++) {
JvmGcBo jvmGcBo = decoder.getValue(i);
jvmGcBo.setAgentId(agentId);
jvmGcBo.setStartTimestamp(startTimestamps.get(i));
jvmGcBo.setTimestamp(timestamps.get(i));
jvmGcBo.setGcType(gcType);
jvmGcBos.add(jvmGcBo);
}
return jvmGcBos;
}
use of com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo in project pinpoint by naver.
the class HbaseSampledJvmGcDaoV2 method getSampledAgentStatList.
@Override
public List<SampledJvmGc> getSampledAgentStatList(String agentId, TimeWindow timeWindow) {
long scanFrom = timeWindow.getWindowRange().getFrom();
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
Range range = Range.newRange(scanFrom, scanTo);
AgentStatMapperV2<JvmGcBo> mapper = operations.createRowMapper(jvmGcDecoder, range);
SampledAgentStatResultExtractor<JvmGcBo, SampledJvmGc> resultExtractor = new SampledAgentStatResultExtractor<>(timeWindow, mapper, jvmGcSampler);
return operations.getSampledAgentStatList(AgentStatType.JVM_GC, resultExtractor, agentId, range);
}
Aggregations