Search in sources :

Example 1 with TagCollection

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);
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection) TagCollection(org.gridkit.jvmtool.event.TagCollection) SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection)

Example 2 with TagCollection

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());
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection) TagCollection(org.gridkit.jvmtool.event.TagCollection) TaggedEvent(org.gridkit.jvmtool.event.TaggedEvent) TimestampedEvent(org.gridkit.jvmtool.event.TimestampedEvent) MultiCounterEvent(org.gridkit.jvmtool.event.MultiCounterEvent)

Aggregations

SimpleTagCollection (org.gridkit.jvmtool.event.SimpleTagCollection)2 TagCollection (org.gridkit.jvmtool.event.TagCollection)2 MultiCounterEvent (org.gridkit.jvmtool.event.MultiCounterEvent)1 TaggedEvent (org.gridkit.jvmtool.event.TaggedEvent)1 TimestampedEvent (org.gridkit.jvmtool.event.TimestampedEvent)1