Search in sources :

Example 1 with SimpleTagCollection

use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.

the class SimpleTagCollectionTest method simple_ops.

@Test
public void simple_ops() {
    SimpleTagCollection tags = new SimpleTagCollection();
    tags.put("A", "1");
    tags.put("B", "1");
    tags.put("B", "2");
    tags.put("B", "3");
    assertThat(tags).containsExactly("A", "B");
    assertThat(tags.tagsFor("A")).containsExactly("1");
    assertThat(tags.tagsFor("B")).containsExactly("1", "2", "3");
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection) Test(org.junit.Test)

Example 2 with SimpleTagCollection

use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.

the class SimpleTagCollectionTest method empty_tag.

@Test
public void empty_tag() {
    SimpleTagCollection tags = new SimpleTagCollection();
    tags.put("A", "");
    assertThat(tags).containsExactly("A");
    assertThat(tags.tagsFor("A")).containsExactly("");
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection) Test(org.junit.Test)

Example 3 with SimpleTagCollection

use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.

the class SimpleTagCollectionTest method removal_ops.

@Test
public void removal_ops() {
    SimpleTagCollection tags = new SimpleTagCollection();
    tags.put("A", "1");
    tags.put("B", "1");
    tags.put("B", "2");
    tags.put("B", "3");
    tags.put("D", "0");
    assertThat(tags).containsExactly("A", "B", "D");
    assertThat(tags.tagsFor("A")).containsExactly("1");
    assertThat(tags.tagsFor("B")).containsExactly("1", "2", "3");
    assertThat(tags.tagsFor("D")).containsExactly("0");
    tags.remove("B", "2");
    assertThat(tags).containsExactly("A", "B", "D");
    assertThat(tags.tagsFor("A")).containsExactly("1");
    assertThat(tags.tagsFor("B")).containsExactly("1", "3");
    assertThat(tags.tagsFor("D")).containsExactly("0");
    tags.remove("B");
    assertThat(tags).containsExactly("A", "D");
    assertThat(tags.tagsFor("A")).containsExactly("1");
    assertThat(tags.tagsFor("B")).isEmpty();
    assertThat(tags.tagsFor("D")).containsExactly("0");
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection) Test(org.junit.Test)

Example 4 with SimpleTagCollection

use of org.gridkit.jvmtool.event.SimpleTagCollection in project jvm-tools by aragozin.

the class StackTraceEventReaderV4 method readCounterSet.

protected void readCounterSet() throws IOException {
    int n = StackTraceCodec.readVarInt(dis);
    int base = StackTraceCodec.readVarInt(dis);
    SimpleTagCollection ts = new SimpleTagCollection(counterDic.get(base).definition);
    readTagSetDelta(ts);
    ensureSlot(counterDic, n);
    CounterSet cs = new CounterSet(ts);
    counterDic.set(n, cs);
}
Also used : SimpleTagCollection(org.gridkit.jvmtool.event.SimpleTagCollection)

Example 5 with SimpleTagCollection

use of org.gridkit.jvmtool.event.SimpleTagCollection 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)

Aggregations

SimpleTagCollection (org.gridkit.jvmtool.event.SimpleTagCollection)8 Test (org.junit.Test)4 IOException (java.io.IOException)1 TagCollection (org.gridkit.jvmtool.event.TagCollection)1