< prev index next >

src/jdk.jfr/share/classes/jdk/jfr/internal/EventWriter.java

Print this page

 39     // Event may not exceed size for a padded integer
 40     private static final long MAX_EVENT_SIZE = (1 << 28) -1;
 41     private static final Unsafe unsafe = Unsafe.getUnsafe();
 42     private static final JVM jvm = JVM.getJVM();
 43 
 44     // The JVM needs access to these values. Don't remove
 45     private final long threadID;
 46     private long startPosition;
 47     private long startPositionAddress;
 48     private long currentPosition;
 49     private long maxPosition;
 50     private boolean valid;
 51     boolean notified; // Not private to avoid being optimized away
 52 
 53     private PlatformEventType eventType;
 54     private boolean started;
 55     private boolean flushOnEnd;
 56     private boolean largeSize = false;
 57 
 58     public static EventWriter getEventWriter() {
 59         EventWriter ew = (EventWriter)JVM.getEventWriter();
 60         return ew != null ? ew : JVM.newEventWriter();
 61     }
 62 
 63     public void putBoolean(boolean i) {
 64         if (isValidForSize(Byte.BYTES)) {
 65             currentPosition += Bits.putBoolean(currentPosition, i);
 66         }
 67     }
 68 
 69     public void putByte(byte i) {
 70         if (isValidForSize(Byte.BYTES)) {
 71             unsafe.putByte(currentPosition, i);
 72             ++currentPosition;
 73         }
 74     }
 75 
 76     public void putChar(char v) {
 77         if (isValidForSize(Character.BYTES + 1)) {
 78             putUncheckedLong(v);
 79         }

 39     // Event may not exceed size for a padded integer
 40     private static final long MAX_EVENT_SIZE = (1 << 28) -1;
 41     private static final Unsafe unsafe = Unsafe.getUnsafe();
 42     private static final JVM jvm = JVM.getJVM();
 43 
 44     // The JVM needs access to these values. Don't remove
 45     private final long threadID;
 46     private long startPosition;
 47     private long startPositionAddress;
 48     private long currentPosition;
 49     private long maxPosition;
 50     private boolean valid;
 51     boolean notified; // Not private to avoid being optimized away
 52 
 53     private PlatformEventType eventType;
 54     private boolean started;
 55     private boolean flushOnEnd;
 56     private boolean largeSize = false;
 57 
 58     public static EventWriter getEventWriter() {
 59         EventWriter ew = JVM.getEventWriter();
 60         return ew != null ? ew : JVM.newEventWriter();
 61     }
 62 
 63     public void putBoolean(boolean i) {
 64         if (isValidForSize(Byte.BYTES)) {
 65             currentPosition += Bits.putBoolean(currentPosition, i);
 66         }
 67     }
 68 
 69     public void putByte(byte i) {
 70         if (isValidForSize(Byte.BYTES)) {
 71             unsafe.putByte(currentPosition, i);
 72             ++currentPosition;
 73         }
 74     }
 75 
 76     public void putChar(char v) {
 77         if (isValidForSize(Character.BYTES + 1)) {
 78             putUncheckedLong(v);
 79         }
< prev index next >