1 /*
2 * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
372
373 // Memory
374 public native void readReservedMemory();
375 public native long allocateMetaspace(ClassLoader classLoader, long size);
376 public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
377 public native long incMetaspaceCapacityUntilGC(long increment);
378 public native long metaspaceCapacityUntilGC();
379 public native boolean metaspaceShouldConcurrentCollect();
380
381 // Don't use these methods directly
382 // Use sun.hotspot.gc.GC class instead.
383 public native int currentGC();
384 public native int allSupportedGC();
385 public native boolean gcSelectedByErgo();
386
387 // Force Young GC
388 public native void youngGC();
389
390 // Force Full GC
391 public native void fullGC();
392
393 // Method tries to start concurrent mark cycle.
394 // It returns false if CM Thread is always in concurrent cycle.
395 public native boolean g1StartConcMarkCycle();
396
397 // Tests on ReservedSpace/VirtualSpace classes
398 public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
399 public native void runMemoryUnitTests();
400 public native void readFromNoaccessArea();
401 public native long getThreadStackSize();
402 public native long getThreadRemainingStackSize();
403
404 // CPU features
405 public native String getCPUFeatures();
406
407 // Native extensions
408 public native long getHeapUsageForContext(int context);
409 public native long getHeapRegionCountForContext(int context);
410 private native int getContextForObject0(Object obj);
411 public int getContextForObject(Object obj) {
|
1 /*
2 * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
372
373 // Memory
374 public native void readReservedMemory();
375 public native long allocateMetaspace(ClassLoader classLoader, long size);
376 public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
377 public native long incMetaspaceCapacityUntilGC(long increment);
378 public native long metaspaceCapacityUntilGC();
379 public native boolean metaspaceShouldConcurrentCollect();
380
381 // Don't use these methods directly
382 // Use sun.hotspot.gc.GC class instead.
383 public native int currentGC();
384 public native int allSupportedGC();
385 public native boolean gcSelectedByErgo();
386
387 // Force Young GC
388 public native void youngGC();
389
390 // Force Full GC
391 public native void fullGC();
392
393 // Returns true if the current GC supports control of its concurrent
394 // phase via requestConcurrentGCPhase(). If false, a request will
395 // always fail.
396 public native boolean supportsConcurrentGCPhaseControl();
397
398 // Returns an array of concurrent phase names provided by this
399 // collector. These are the names recognized by
400 // requestConcurrentGCPhase().
401 public native String[] getConcurrentGCPhases();
402
403 // Attempt to put the collector into the indicated concurrent phase,
404 // and attempt to remain in that state until a new request is made.
405 //
406 // Returns immediately if already in the requested phase.
407 // Otherwise, waits until the phase is reached.
408 //
409 // Throws IllegalStateException if unsupported by the current collector.
410 // Throws NullPointerException if phase is null.
411 // Throws IllegalArgumentException if phase is not valid for the current collector.
412 public void requestConcurrentGCPhase(String phase) {
413 if (!supportsConcurrentGCPhaseControl()) {
414 throw new IllegalStateException("Concurrent GC phase control not supported");
415 } else if (phase == null) {
416 throw new NullPointerException("null phase");
417 } else if (!requestConcurrentGCPhase0(phase)) {
418 throw new IllegalArgumentException("Unknown concurrent GC phase: " + phase);
419 }
420 }
421
422 // Helper for requestConcurrentGCPhase(). Returns true if request
423 // succeeded, false if the phase is invalid.
424 private native boolean requestConcurrentGCPhase0(String phase);
425
426 // Method tries to start concurrent mark cycle.
427 // It returns false if CM Thread is always in concurrent cycle.
428 public native boolean g1StartConcMarkCycle();
429
430 // Tests on ReservedSpace/VirtualSpace classes
431 public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
432 public native void runMemoryUnitTests();
433 public native void readFromNoaccessArea();
434 public native long getThreadStackSize();
435 public native long getThreadRemainingStackSize();
436
437 // CPU features
438 public native String getCPUFeatures();
439
440 // Native extensions
441 public native long getHeapUsageForContext(int context);
442 public native long getHeapRegionCountForContext(int context);
443 private native int getContextForObject0(Object obj);
444 public int getContextForObject(Object obj) {
|