use of org.gridkit.jvmtool.event.TagCollection in project jvm-tools by aragozin.
the class StackTraceEventReaderV4 method readEvent.
protected void readEvent() throws IOException {
threadDetails = false;
TagCollection tc = tagDic.get(StackTraceCodec.readVarInt(dis));
tags = new SimpleTagCollection(tc);
// timestamp
readEventTimestamp();
// counters
readEventCounters();
// thread stack trace
readEventStackTrace();
// wipe encoding tags
tags.remove(StackTraceCodec.TK_PART);
}
use of org.gridkit.jvmtool.event.TagCollection in project jvm-tools by aragozin.
the class StackTraceEventWriterV4 method storeThreadEvent.
protected void storeThreadEvent(ThreadTraceEvent snap) throws IOException {
TagCollection stags = (snap instanceof TaggedEvent) ? ((TaggedEvent) snap).tags() : null;
CounterCollection scc = (snap instanceof MultiCounterEvent) ? ((MultiCounterEvent) snap).counters() : null;
tagBuilder.clear();
// mark unconditionally
markTags();
long timestamp = -1;
if (snap instanceof TimestampedEvent) {
markTimestamp();
timestamp = ((TimestampedEvent) snap).timestamp();
}
//TODO empty stack trace is encoded for compatibility with old readers
if (snap.stackTrace() != null) /*&& !snap.stackTrace().isEmpty()*/
{
markThreadStackTrace();
for (StackFrame ste : snap.stackTrace()) {
intern(ste.toStackTraceElement());
}
}
if (scc != null) {
ensureCounters(scc);
}
int tagSetId = ensureTagSet(stags);
dos.writeByte(StackTraceCodec.TAG_EVENT);
StackTraceCodec.writeVarInt(dos, tagSetId);
writeTimestamp(timestamp);
writeCounters(scc);
writeTrace(snap.stackTrace());
}
Aggregations