test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitor.java
changeset 51138 914f305ba6fa
parent 51074 bf686c47c109
child 51175 65556ae796ad
equal deleted inserted replaced
51137:e3bcc86855dd 51138:914f305ba6fa
    43       System.err.println("java.library.path: " + System.getProperty("java.library.path"));
    43       System.err.println("java.library.path: " + System.getProperty("java.library.path"));
    44       throw ule;
    44       throw ule;
    45     }
    45     }
    46   }
    46   }
    47 
    47 
    48   /** Set a specific sampling rate, 0 samples every allocation. */
    48   /** Set a specific sampling interval, 0 samples every allocation. */
    49   public native static void setSamplingRate(int rate);
    49   public native static void setSamplingInterval(int interval);
    50   public native static void enableSamplingEvents();
    50   public native static void enableSamplingEvents();
    51   public native static boolean enableSamplingEventsForTwoThreads(Thread firstThread, Thread secondThread);
    51   public native static boolean enableSamplingEventsForTwoThreads(Thread firstThread, Thread secondThread);
    52   public native static void disableSamplingEvents();
    52   public native static void disableSamplingEvents();
    53 
    53 
    54   /**
    54   /**
   129     arrays = null;
   129     arrays = null;
   130   }
   130   }
   131 
   131 
   132   public static int[][][] sampleEverything() {
   132   public static int[][][] sampleEverything() {
   133     enableSamplingEvents();
   133     enableSamplingEvents();
   134     setSamplingRate(0);
   134     setSamplingInterval(0);
   135 
   135 
   136     // Loop around an allocation loop and wait until the tlabs have settled.
   136     // Loop around an allocation loop and wait until the tlabs have settled.
   137     final int maxTries = 10;
   137     final int maxTries = 10;
   138     int[][][] result = new int[maxTries][][];
   138     int[][][] result = new int[maxTries][][];
   139     for (int i = 0; i < maxTries; i++) {
   139     for (int i = 0; i < maxTries; i++) {