< prev index next >
test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitor.java
Print this page
rev 49264 : [mq]: event-only
rev 49266 : [mq]: event4
rev 49267 : [mq]: event5
rev 49268 : [mq]: event6
*** 38,57 ****
System.err.println("java.library.path: " + System.getProperty("java.library.path"));
throw ule;
}
}
! /** Enable heap monitoring sampling with default value for rate. */
! public static void enableSamplingRate() {
! setSamplingRate(1 << 19);
! }
!
! public static void disableSamplingRate() {
! setSamplingRate(0);
! }
!
! /** Set a specific sampling rate, 0 turns off sampling. */
public native static void setSamplingRate(int rate);
/** Set a specific garbage history buffer. */
public native static void setGarbageHistory(int amount);
public native static void enableSamplingEvents();
--- 38,48 ----
System.err.println("java.library.path: " + System.getProperty("java.library.path"));
throw ule;
}
}
! /** Set a specific sampling rate, 0 samples every allocation. */
public native static void setSamplingRate(int rate);
/** Set a specific garbage history buffer. */
public native static void setGarbageHistory(int amount);
public native static void enableSamplingEvents();
*** 64,78 ****
*/
public static List<Frame> allocate(int depth) {
List<Frame> frames = new ArrayList<Frame>();
if (depth > 1) {
createStackDepth(depth - 1, frames);
! frames.add(new Frame("allocate", "(I)Ljava/util/List;", "HeapMonitor.java", 68));
} else {
actuallyAllocate();
frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 131));
! frames.add(new Frame("allocate", "(I)Ljava/util/List;", "HeapMonitor.java", 71));
}
return frames;
}
/**
--- 55,69 ----
*/
public static List<Frame> allocate(int depth) {
List<Frame> frames = new ArrayList<Frame>();
if (depth > 1) {
createStackDepth(depth - 1, frames);
! frames.add(new Frame("allocate", "(I)Ljava/util/List;", "HeapMonitor.java", 59));
} else {
actuallyAllocate();
frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 131));
! frames.add(new Frame("allocate", "(I)Ljava/util/List;", "HeapMonitor.java", 62));
}
return frames;
}
/**
*** 82,120 ****
*/
public static List<Frame> allocate() {
int sum = 0;
List<Frame> frames = new ArrayList<Frame>();
allocate(frames);
! frames.add(new Frame("allocate", "()Ljava/util/List;", "HeapMonitor.java", 86));
return frames;
}
private static void createStackDepth(int depth, List<Frame> frames) {
if (depth > 1) {
createStackDepth(depth - 1, frames);
! frames.add(new Frame("createStackDepth", "(ILjava/util/List;)V", "HeapMonitor.java", 93));
} else {
allocate(frames);
! frames.add(new Frame("createStackDepth", "(ILjava/util/List;)V", "HeapMonitor.java", 96));
}
}
private static void allocate(List<Frame> frames) {
int sum = 0;
for (int j = 0; j < 1000; j++) {
sum += actuallyAllocate();
}
! frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 131));
! frames.add(new Frame("allocate", "(Ljava/util/List;)V", "HeapMonitor.java", 104));
}
public static List<Frame> repeatAllocate(int max) {
List<Frame> frames = null;
for (int i = 0; i < max; i++) {
frames = allocate();
}
! frames.add(new Frame("repeatAllocate", "(I)Ljava/util/List;", "HeapMonitor.java", 113));
return frames;
}
private static int actuallyAllocate() {
int sum = 0;
--- 73,111 ----
*/
public static List<Frame> allocate() {
int sum = 0;
List<Frame> frames = new ArrayList<Frame>();
allocate(frames);
! frames.add(new Frame("allocate", "()Ljava/util/List;", "HeapMonitor.java", 77));
return frames;
}
private static void createStackDepth(int depth, List<Frame> frames) {
if (depth > 1) {
createStackDepth(depth - 1, frames);
! frames.add(new Frame("createStackDepth", "(ILjava/util/List;)V", "HeapMonitor.java", 84));
} else {
allocate(frames);
! frames.add(new Frame("createStackDepth", "(ILjava/util/List;)V", "HeapMonitor.java", 87));
}
}
private static void allocate(List<Frame> frames) {
int sum = 0;
for (int j = 0; j < 1000; j++) {
sum += actuallyAllocate();
}
! frames.add(new Frame("actuallyAllocate", "()I", "HeapMonitor.java", 122));
! frames.add(new Frame("allocate", "(Ljava/util/List;)V", "HeapMonitor.java", 95));
}
public static List<Frame> repeatAllocate(int max) {
List<Frame> frames = null;
for (int i = 0; i < max; i++) {
frames = allocate();
}
! frames.add(new Frame("repeatAllocate", "(I)Ljava/util/List;", "HeapMonitor.java", 104));
return frames;
}
private static int actuallyAllocate() {
int sum = 0;
< prev index next >