< prev index next >

test/hotspot/gtest/metaspace/metaspaceGtestContexts.hpp

Print this page

 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 
 26 #ifndef GTEST_METASPACE_METASPACE_GTESTCONTEXTS_HPP
 27 #define GTEST_METASPACE_METASPACE_GTESTCONTEXTS_HPP
 28 
 29 #include "memory/allocation.hpp"
 30 #include "memory/metaspace/chunklevel.hpp"
 31 #include "memory/metaspace/metachunk.hpp"
 32 #include "memory/metaspace/testHelpers.hpp"
 33 #include "metaspaceGtestCommon.hpp"
 34 
 35 using metaspace::Metachunk;
 36 using metaspace::chunklevel_t;
 37 using namespace metaspace::chunklevel;
 38 
 39 class MetaspaceGtestContext : public metaspace::MetaspaceTestContext {

 40 public:
 41   MetaspaceGtestContext(size_t commit_limit = 0, size_t reserve_limit = 0) :
 42     metaspace::MetaspaceTestContext("gtest-metaspace-context", commit_limit, reserve_limit)
 43   {}



 44 };
 45 
 46 class ChunkGtestContext : public MetaspaceGtestContext {
 47 
 48   int _num_chunks_allocated;
 49 
 50   void checked_alloc_chunk_0(Metachunk** p_return_value, chunklevel_t preferred_level,
 51                              chunklevel_t max_level, size_t min_committed_size);
 52 
 53   // Test pattern established when allocating from the chunk with allocate_from_chunk_with_tests().
 54   void test_pattern(Metachunk* c, size_t word_size);
 55   void test_pattern(Metachunk* c) { test_pattern(c, c->used_words()); }
 56 
 57 public:
 58 
 59   ChunkGtestContext(size_t commit_limit = 0, size_t reserve_limit = 0) :
 60     MetaspaceGtestContext(commit_limit, reserve_limit),
 61     _num_chunks_allocated(0)
 62   {}
 63 

 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 
 26 #ifndef GTEST_METASPACE_METASPACE_GTESTCONTEXTS_HPP
 27 #define GTEST_METASPACE_METASPACE_GTESTCONTEXTS_HPP
 28 
 29 #include "memory/allocation.hpp"
 30 #include "memory/metaspace/chunklevel.hpp"
 31 #include "memory/metaspace/metachunk.hpp"
 32 #include "memory/metaspace/testHelpers.hpp"
 33 #include "metaspaceGtestCommon.hpp"
 34 
 35 using metaspace::Metachunk;
 36 using metaspace::chunklevel_t;
 37 using namespace metaspace::chunklevel;
 38 
 39 class MetaspaceGtestContext : public metaspace::MetaspaceTestContext {
 40   int _num_arenas_created;
 41 public:
 42   MetaspaceGtestContext(size_t commit_limit = 0, size_t reserve_limit = 0) :
 43     metaspace::MetaspaceTestContext("gtest-metaspace-context", commit_limit, reserve_limit),
 44     _num_arenas_created(0) {}
 45 
 46   int num_arenas_created() const { return _num_arenas_created; }
 47   void inc_num_arenas_created() { _num_arenas_created ++; }
 48 };
 49 
 50 class ChunkGtestContext : public MetaspaceGtestContext {
 51 
 52   int _num_chunks_allocated;
 53 
 54   void checked_alloc_chunk_0(Metachunk** p_return_value, chunklevel_t preferred_level,
 55                              chunklevel_t max_level, size_t min_committed_size);
 56 
 57   // Test pattern established when allocating from the chunk with allocate_from_chunk_with_tests().
 58   void test_pattern(Metachunk* c, size_t word_size);
 59   void test_pattern(Metachunk* c) { test_pattern(c, c->used_words()); }
 60 
 61 public:
 62 
 63   ChunkGtestContext(size_t commit_limit = 0, size_t reserve_limit = 0) :
 64     MetaspaceGtestContext(commit_limit, reserve_limit),
 65     _num_chunks_allocated(0)
 66   {}
 67 
< prev index next >