src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
branchJEP-349-branch
changeset 57360 5d043a159d5c
parent 53014 339d2fbe8675
child 58165 8584c5b96cb6
equal deleted inserted replaced
57359:4cab5edc2950 57360:5d043a159d5c
     1 /*
     1 /*
     2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   268      * recording can be set to true/false with {@link #beginRecording()}
   268      * recording can be set to true/false with {@link #beginRecording()}
   269      * {@link #endRecording()}
   269      * {@link #endRecording()}
   270      *
   270      *
   271      * @param file the file where data should be written, or null if it should
   271      * @param file the file where data should be written, or null if it should
   272      *        not be copied out (in memory).
   272      *        not be copied out (in memory).
   273      *
       
   274      * @throws IOException
   273      * @throws IOException
   275      */
   274      */
   276     public native void setOutput(String file);
   275     public native void setOutput(String file);
   277 
   276 
   278     /**
   277     /**
   457     /**
   456     /**
   458      * Flushes the EventWriter for this thread.
   457      * Flushes the EventWriter for this thread.
   459      */
   458      */
   460     public static native boolean flush(EventWriter writer, int uncommittedSize, int requestedSize);
   459     public static native boolean flush(EventWriter writer, int uncommittedSize, int requestedSize);
   461 
   460 
       
   461     /**
       
   462      * Flushes all thread buffers to disk and the constant pool data needed to read
       
   463      * them.
       
   464      * <p>
       
   465      * When the method returns, the chunk header should be updated with valid
       
   466      * pointers to the metadata event, last check point event, correct file size and
       
   467      * the generation id.
       
   468      *
       
   469      * @param includeMetadata {@code true} if metadata event should be written, {@code false}
       
   470      *        otherwise
       
   471      * @param flushCounter the (flushCounter + 1= should be written to the chunk header, by default the
       
   472      *        value in the chunk header should be {@code 1} and set {@code 0} once the chunk is complete.
       
   473      */
       
   474     public native void flush(boolean includeMetadata, short flushCounter);
   462     /**
   475     /**
   463      * Sets the location of the disk repository, to be used at an emergency
   476      * Sets the location of the disk repository, to be used at an emergency
   464      * dump.
   477      * dump.
   465      *
   478      *
   466      * @param dirText
   479      * @param dirText
   521      * Test if a chunk rotation is warranted.
   534      * Test if a chunk rotation is warranted.
   522      *
   535      *
   523      * @return if it is time to perform a chunk rotation
   536      * @return if it is time to perform a chunk rotation
   524      */
   537      */
   525     public native boolean shouldRotateDisk();
   538     public native boolean shouldRotateDisk();
       
   539 
       
   540     /**
       
   541      * Exclude a thread from the jfr system
       
   542      *
       
   543      */
       
   544     public native void exclude(Thread thread);
       
   545 
       
   546     /**
       
   547      * Include a thread back into the jfr system
       
   548      *
       
   549      */
       
   550     public native void include(Thread thread);
       
   551 
       
   552     /**
       
   553      * Test if a thread ius currently excluded from the jfr system.
       
   554      *
       
   555      * @return is thread currently excluded
       
   556      */
       
   557     public native boolean isExcluded(Thread thread);
       
   558 
       
   559     /**
       
   560      * Get the start time in nanos from the header of the current chunk
       
   561      *
       
   562      *@return start time of the recording in nanos, -1 in case of in-memory
       
   563      */
       
   564     public native long getChunkStartNanos();
   526 }
   565 }