< prev index next >

test/hotspot/gtest/memory/test_metaspace_allocation.cpp

Print this page
rev 57601 : [mq]: metaspace-improvement


  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/metaspace.hpp"
  28 #include "runtime/mutex.hpp"
  29 #include "runtime/mutexLocker.hpp"
  30 #include "runtime/os.hpp"
  31 #include "utilities/align.hpp"
  32 #include "utilities/debug.hpp"
  33 #include "utilities/globalDefinitions.hpp"
  34 #include "utilities/ostream.hpp"
  35 #include "unittest.hpp"
  36 


  37 #define NUM_PARALLEL_METASPACES                 50
  38 #define MAX_PER_METASPACE_ALLOCATION_WORDSIZE   (512 * K)
  39 
  40 //#define DEBUG_VERBOSE true
  41 
  42 #ifdef DEBUG_VERBOSE
  43 
  44 struct chunkmanager_statistics_t {
  45   int num_specialized_chunks;
  46   int num_small_chunks;
  47   int num_medium_chunks;
  48   int num_humongous_chunks;
  49 };
  50 
  51 extern void test_metaspace_retrieve_chunkmanager_statistics(Metaspace::MetadataType mdType, chunkmanager_statistics_t* out);
  52 
  53 static void print_chunkmanager_statistics(outputStream* st, Metaspace::MetadataType mdType) {
  54   chunkmanager_statistics_t stat;
  55   test_metaspace_retrieve_chunkmanager_statistics(mdType, &stat);
  56   st->print_cr("free chunks: %d / %d / %d / %d", stat.num_specialized_chunks, stat.num_small_chunks,


 254   do_test(Metaspace::NonClassType, 1, 1000, 100, 0);
 255 }
 256 
 257 TEST_VM_F(MetaspaceAllocationTest, single_space_class) {
 258   do_test(Metaspace::ClassType, 1, 1000, 100, 0);
 259 }
 260 
 261 TEST_VM_F(MetaspaceAllocationTest, multi_space_nonclass) {
 262   do_test(Metaspace::NonClassType, NUM_PARALLEL_METASPACES, 100, 1000, 0.0);
 263 }
 264 
 265 TEST_VM_F(MetaspaceAllocationTest, multi_space_class) {
 266   do_test(Metaspace::ClassType, NUM_PARALLEL_METASPACES, 100, 1000, 0.0);
 267 }
 268 
 269 TEST_VM_F(MetaspaceAllocationTest, multi_space_nonclass_2) {
 270   // many metaspaces, with humongous chunks mixed in.
 271   do_test(Metaspace::NonClassType, NUM_PARALLEL_METASPACES, 100, 1000, .006f);
 272 }
 273 



  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "memory/metaspace.hpp"
  28 #include "runtime/mutex.hpp"
  29 #include "runtime/mutexLocker.hpp"
  30 #include "runtime/os.hpp"
  31 #include "utilities/align.hpp"
  32 #include "utilities/debug.hpp"
  33 #include "utilities/globalDefinitions.hpp"
  34 #include "utilities/ostream.hpp"
  35 #include "unittest.hpp"
  36 
  37 #if 0
  38 
  39 #define NUM_PARALLEL_METASPACES                 50
  40 #define MAX_PER_METASPACE_ALLOCATION_WORDSIZE   (512 * K)
  41 
  42 //#define DEBUG_VERBOSE true
  43 
  44 #ifdef DEBUG_VERBOSE
  45 
  46 struct chunkmanager_statistics_t {
  47   int num_specialized_chunks;
  48   int num_small_chunks;
  49   int num_medium_chunks;
  50   int num_humongous_chunks;
  51 };
  52 
  53 extern void test_metaspace_retrieve_chunkmanager_statistics(Metaspace::MetadataType mdType, chunkmanager_statistics_t* out);
  54 
  55 static void print_chunkmanager_statistics(outputStream* st, Metaspace::MetadataType mdType) {
  56   chunkmanager_statistics_t stat;
  57   test_metaspace_retrieve_chunkmanager_statistics(mdType, &stat);
  58   st->print_cr("free chunks: %d / %d / %d / %d", stat.num_specialized_chunks, stat.num_small_chunks,


 256   do_test(Metaspace::NonClassType, 1, 1000, 100, 0);
 257 }
 258 
 259 TEST_VM_F(MetaspaceAllocationTest, single_space_class) {
 260   do_test(Metaspace::ClassType, 1, 1000, 100, 0);
 261 }
 262 
 263 TEST_VM_F(MetaspaceAllocationTest, multi_space_nonclass) {
 264   do_test(Metaspace::NonClassType, NUM_PARALLEL_METASPACES, 100, 1000, 0.0);
 265 }
 266 
 267 TEST_VM_F(MetaspaceAllocationTest, multi_space_class) {
 268   do_test(Metaspace::ClassType, NUM_PARALLEL_METASPACES, 100, 1000, 0.0);
 269 }
 270 
 271 TEST_VM_F(MetaspaceAllocationTest, multi_space_nonclass_2) {
 272   // many metaspaces, with humongous chunks mixed in.
 273   do_test(Metaspace::NonClassType, NUM_PARALLEL_METASPACES, 100, 1000, .006f);
 274 }
 275 
 276 #endif
< prev index next >