< prev index next >

test/lib/sun/hotspot/WhiteBox.java

Print this page
rev 2451 : imported patch whitebox
   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   // Attempt to put the collector into the indicated concurrent phase,
 399   // and attempt to remain in that state until a new request is made.
 400   //
 401   // Returns immediately if already in that state.  Otherwise, waits
 402   // until the state is reached.
 403   //
 404   // Throws IllegalStateException if unsupported by the current collector.
 405   // Throws NullPointerException if phase is null.
 406   // Throws IllegalArgumentException if phase is not valid for the current collector.
 407   public void requestConcurrentGCPhase(String phase) {
 408     if (!supportsConcurrentGCPhaseControl()) {
 409       throw new IllegalStateException("Concurrent GC phase control not supported");
 410     } else if (phase == null) {
 411       throw new NullPointerException("null phase");
 412     } else if (!requestConcurrentGCPhase0(phase)) {
 413       throw new IllegalArgumentException("Unknown concurrent GC phase: " + phase);
 414     }
 415   }
 416 
 417   // Helper for requestConcurrentGCPhase().  Returns true if request
 418   // succeeded, false if the phase is invalid.
 419   private native boolean requestConcurrentGCPhase0(String phase);
 420 
 421   // Method tries to start concurrent mark cycle.
 422   // It returns false if CM Thread is always in concurrent cycle.
 423   public native boolean g1StartConcMarkCycle();
 424 
 425   // Tests on ReservedSpace/VirtualSpace classes
 426   public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
 427   public native void runMemoryUnitTests();
 428   public native void readFromNoaccessArea();
 429   public native long getThreadStackSize();
 430   public native long getThreadRemainingStackSize();
 431 
 432   // CPU features
 433   public native String getCPUFeatures();
 434 
 435   // Native extensions
 436   public native long getHeapUsageForContext(int context);
 437   public native long getHeapRegionCountForContext(int context);
 438   private native int getContextForObject0(Object obj);
 439   public         int getContextForObject(Object obj) {


< prev index next >