@Test public void event() { mh.event(gen, "task1", 8); mh.event(gen, "task2", 5); List<Mark> marks = mh.read(false); assertEquals(2, marks.size()); List<Mark> expected = Arrays.asList(Mark.event(gen, 8, "task1"), Mark.event(gen, 5, "task2")); assertEquals(expected, marks); }
@Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); }
VarHandleMarkHolder extends MarkHolder { @Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); } }
VarHandleMarkHolder extends MarkHolder { @Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); } VarHandleMarkHolder();   VarHandleMarkHolder(int maxEvents); }
VarHandleMarkHolder extends MarkHolder { @Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); } VarHandleMarkHolder();   VarHandleMarkHolder(int maxEvents); @Override void start(long gen, String taskName, String tagName, long tagId, long nanoTime); @Override void start(long gen, String taskName, long nanoTime); @Override void start(long gen, String taskName, String subTaskName, long nanoTime); @Override void link(long gen, long linkId); @Override void stop(long gen, long nanoTime); @Override void stop(long gen, String taskName, String tagName, long tagId, long nanoTime); @Override void stop(long gen, String taskName, long nanoTime); @Override void stop(long gen, String taskName, String subTaskName, long nanoTime); @Override void event(long gen, String eventName, String tagName, long tagId, long nanoTime); @Override void event(long gen, String eventName, long nanoTime); @Override void event(long gen, String eventName, String subEventName, long nanoTime); @Override void attachTag(long gen, String tagName, long tagId); @Override void attachKeyedTag(long gen, String name, long value); @Override void attachKeyedTag(long gen, String name, long value0, long value1); @Override void attachKeyedTag(long gen, String name, String value); @Override void resetForTest(); @Override List<Mark> read(boolean concurrentWrites); @Override int maxMarks(); }
VarHandleMarkHolder extends MarkHolder { @Override public void event(long gen, String eventName, String tagName, long tagId, long nanoTime) { long localIdx = (long) IDX.get(this); int i = (int) (localIdx & maxEventsMax); STRINGS.setOpaque(taskNames, i, eventName); STRINGS.setOpaque(tagNames, i, tagName); LONGS.setOpaque(tagIds, i, tagId); LONGS.setOpaque(nanoTimes, i, nanoTime); LONGS.setOpaque(genOps, i, gen + EVENT_T_OP); IDX.setRelease(this, localIdx + 1); VarHandle.storeStoreFence(); } VarHandleMarkHolder();   VarHandleMarkHolder(int maxEvents); @Override void start(long gen, String taskName, String tagName, long tagId, long nanoTime); @Override void start(long gen, String taskName, long nanoTime); @Override void start(long gen, String taskName, String subTaskName, long nanoTime); @Override void link(long gen, long linkId); @Override void stop(long gen, long nanoTime); @Override void stop(long gen, String taskName, String tagName, long tagId, long nanoTime); @Override void stop(long gen, String taskName, long nanoTime); @Override void stop(long gen, String taskName, String subTaskName, long nanoTime); @Override void event(long gen, String eventName, String tagName, long tagId, long nanoTime); @Override void event(long gen, String eventName, long nanoTime); @Override void event(long gen, String eventName, String subEventName, long nanoTime); @Override void attachTag(long gen, String tagName, long tagId); @Override void attachKeyedTag(long gen, String name, long value); @Override void attachKeyedTag(long gen, String name, long value0, long value1); @Override void attachKeyedTag(long gen, String name, String value); @Override void resetForTest(); @Override List<Mark> read(boolean concurrentWrites); @Override int maxMarks();  }