< prev index next >

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

Print this page

 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 package jdk.jfr.internal;
 27 
 28 import java.util.List;
 29 
 30 import jdk.internal.vm.annotation.IntrinsicCandidate;
 31 import jdk.jfr.Event;

 32 import jdk.jfr.internal.handlers.EventHandler;
 33 
 34 /**
 35  * Interface against the JVM.
 36  *
 37  */
 38 public final class JVM {
 39     private static final JVM jvm = new JVM();
 40 
 41     // JVM signals file changes by doing Object#notify on this object
 42     static final Object FILE_DELTA_CHANGE = new Object();
 43 
 44     static final long RESERVED_CLASS_ID_LIMIT = 500;
 45 
 46     private volatile boolean nativeOK;
 47 
 48     private static native void registerNatives();
 49 
 50     static {
 51         registerNatives();

122      *
123      * @return list of event classes.
124      */
125     public native List<Class<? extends jdk.internal.event.Event>> getAllEventClasses();
126 
127     /**
128      * Return a count of the number of unloaded classes deriving from {@link Event}
129      *
130      * @return number of unloaded event classes.
131      */
132     public native long getUnloadedEventClassCount();
133 
134     /**
135      * Return a unique identifier for a class. The class is marked as being
136      * "in use" in JFR.
137      *
138      * @param clazz clazz
139      *
140      * @return a unique class identifier
141      */
142     @IntrinsicCandidate
143     public static native long getClassId(Class<?> clazz);
144 
145     /**
146      * Return process identifier.
147      *
148      * @return process identifier
149      */
150     public native String getPid();
151 
152     /**
153      * Return unique identifier for stack trace.
154      *
155      * Requires that JFR has been started with {@link #createNativeJFR()}
156      *
157      * @param skipCount number of frames to skip
158      * @return a unique stack trace identifier
159      */
160     public native long getStackTraceId(int skipCount);
161 
162     /**

430      * To convert ticks to wall clock time.
431      */
432     public native double getTimeConversionFactor();
433 
434     /**
435      * Return a unique identifier for a class. Compared to {@link #getClassId(Class)},
436      * this method does not tag the class as being "in-use".
437      *
438      * @param clazz class
439      *
440      * @return a unique class identifier
441      */
442     public native long getTypeId(Class<?> clazz);
443 
444     /**
445      * Fast path fetching the EventWriter using VM intrinsics
446      *
447      * @return thread local EventWriter
448      */
449     @IntrinsicCandidate
450     public static native Object getEventWriter();
451 
452     /**
453      * Create a new EventWriter
454      *
455      * @return thread local EventWriter
456      */
457     public static native EventWriter newEventWriter();
458 
459     /**
460      * Flushes the EventWriter for this thread.
461      */
462     public static native boolean flush(EventWriter writer, int uncommittedSize, int requestedSize);
463 
464     /**
465      * Flushes all thread buffers to disk and the constant pool data needed to read
466      * them.
467      * <p>
468      * When the method returns, the chunk header should be updated with valid
469      * pointers to the metadata event, last check point event, correct file size and
470      * the generation id.

 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 package jdk.jfr.internal;
 27 
 28 import java.util.List;
 29 
 30 import jdk.internal.vm.annotation.IntrinsicCandidate;
 31 import jdk.jfr.Event;
 32 import jdk.jfr.internal.EventWriter;
 33 import jdk.jfr.internal.handlers.EventHandler;
 34 
 35 /**
 36  * Interface against the JVM.
 37  *
 38  */
 39 public final class JVM {
 40     private static final JVM jvm = new JVM();
 41 
 42     // JVM signals file changes by doing Object#notify on this object
 43     static final Object FILE_DELTA_CHANGE = new Object();
 44 
 45     static final long RESERVED_CLASS_ID_LIMIT = 500;
 46 
 47     private volatile boolean nativeOK;
 48 
 49     private static native void registerNatives();
 50 
 51     static {
 52         registerNatives();

123      *
124      * @return list of event classes.
125      */
126     public native List<Class<? extends jdk.internal.event.Event>> getAllEventClasses();
127 
128     /**
129      * Return a count of the number of unloaded classes deriving from {@link Event}
130      *
131      * @return number of unloaded event classes.
132      */
133     public native long getUnloadedEventClassCount();
134 
135     /**
136      * Return a unique identifier for a class. The class is marked as being
137      * "in use" in JFR.
138      *
139      * @param clazz clazz
140      *
141      * @return a unique class identifier
142      */

143     public static native long getClassId(Class<?> clazz);
144 
145     /**
146      * Return process identifier.
147      *
148      * @return process identifier
149      */
150     public native String getPid();
151 
152     /**
153      * Return unique identifier for stack trace.
154      *
155      * Requires that JFR has been started with {@link #createNativeJFR()}
156      *
157      * @param skipCount number of frames to skip
158      * @return a unique stack trace identifier
159      */
160     public native long getStackTraceId(int skipCount);
161 
162     /**

430      * To convert ticks to wall clock time.
431      */
432     public native double getTimeConversionFactor();
433 
434     /**
435      * Return a unique identifier for a class. Compared to {@link #getClassId(Class)},
436      * this method does not tag the class as being "in-use".
437      *
438      * @param clazz class
439      *
440      * @return a unique class identifier
441      */
442     public native long getTypeId(Class<?> clazz);
443 
444     /**
445      * Fast path fetching the EventWriter using VM intrinsics
446      *
447      * @return thread local EventWriter
448      */
449     @IntrinsicCandidate
450     public static native EventWriter getEventWriter();
451 
452     /**
453      * Create a new EventWriter
454      *
455      * @return thread local EventWriter
456      */
457     public static native EventWriter newEventWriter();
458 
459     /**
460      * Flushes the EventWriter for this thread.
461      */
462     public static native boolean flush(EventWriter writer, int uncommittedSize, int requestedSize);
463 
464     /**
465      * Flushes all thread buffers to disk and the constant pool data needed to read
466      * them.
467      * <p>
468      * When the method returns, the chunk header should be updated with valid
469      * pointers to the metadata event, last check point event, correct file size and
470      * the generation id.
< prev index next >