< prev index next >

test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitor.java

Print this page
rev 48552 : [mq]: heap10a
rev 48553 : [mq]: heap14_rebased
rev 48556 : [mq]: heap17
rev 48557 : [mq]: heap17


  21  * questions.
  22  */
  23 
  24 package MyPackage;
  25 
  26 import java.util.ArrayList;
  27 import java.util.List;
  28 
  29 /** API for handling the underlying heap sampling monitoring system. */
  30 public class HeapMonitor {
  31   static {
  32     try {
  33       System.loadLibrary("HeapMonitor");
  34     } catch (UnsatisfiedLinkError ule) {
  35       System.err.println("Could not load HeapMonitor library");
  36       System.err.println("java.library.path: " + System.getProperty("java.library.path"));
  37       throw ule;
  38     }
  39   }
  40 
  41   private static int arrays[][];
  42 
  43   /** Enable heap monitoring sampling given a rate and maximum garbage to keep in memory. */
  44   public native static void enableSampling(int rate, int maximumGarbage);
  45 
  46   /** Enable heap monitoring sampling given a rate. */
  47   public static void enableSampling(int rate) {
  48     enableSampling(rate, 200);
  49   }
  50 
  51   /** Enable heap monitoring sampling with default values for rate and maximum garbage. */
  52   public static void enableSampling() {
  53     enableSampling(1 << 19);
  54   }
  55 
  56   public native static void disableSampling();
  57   public native static boolean areSamplingStatisticsZero();
  58   public native static boolean statsHaveExpectedNumberSamples(int expected, int percentError);
  59 
  60   /** Do the frames provided exist in live, recent garbage, and frequent garbage. */
  61   public native static boolean framesExistEverywhere(Frame[] frames);




  21  * questions.
  22  */
  23 
  24 package MyPackage;
  25 
  26 import java.util.ArrayList;
  27 import java.util.List;
  28 
  29 /** API for handling the underlying heap sampling monitoring system. */
  30 public class HeapMonitor {
  31   static {
  32     try {
  33       System.loadLibrary("HeapMonitor");
  34     } catch (UnsatisfiedLinkError ule) {
  35       System.err.println("Could not load HeapMonitor library");
  36       System.err.println("java.library.path: " + System.getProperty("java.library.path"));
  37       throw ule;
  38     }
  39   }
  40 
  41   private static volatile int arrays[][];
  42 
  43   /** Enable heap monitoring sampling given a rate and maximum garbage to keep in memory. */
  44   public native static void enableSampling(int rate, int maximumGarbage);
  45 
  46   /** Enable heap monitoring sampling given a rate. */
  47   public static void enableSampling(int rate) {
  48     enableSampling(rate, 200);
  49   }
  50 
  51   /** Enable heap monitoring sampling with default values for rate and maximum garbage. */
  52   public static void enableSampling() {
  53     enableSampling(1 << 19);
  54   }
  55 
  56   public native static void disableSampling();
  57   public native static boolean areSamplingStatisticsZero();
  58   public native static boolean statsHaveExpectedNumberSamples(int expected, int percentError);
  59 
  60   /** Do the frames provided exist in live, recent garbage, and frequent garbage. */
  61   public native static boolean framesExistEverywhere(Frame[] frames);


< prev index next >