src/hotspot/share/services/epsilonMemoryPool.hpp
branchepsilon-gc-branch
changeset 55767 8e22715afabc
child 55939 c5c3e1a5c3f0
equal deleted inserted replaced
47701:be620a591379 55767:8e22715afabc
       
     1 /*
       
     2  * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.
       
     7  *
       
     8  * This code is distributed in the hope that it will be useful, but WITHOUT
       
     9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    11  * version 2 for more details (a copy is included in the LICENSE file that
       
    12  * accompanied this code).
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License version
       
    15  * 2 along with this work; if not, write to the Free Software Foundation,
       
    16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    17  *
       
    18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    19  * or visit www.oracle.com if you need additional information or have any
       
    20  * questions.
       
    21  *
       
    22  */
       
    23 
       
    24 #ifndef SHARE_VM_SERVICES_EPSILON_COLLECTORPOLICY_HPP
       
    25 #define SHARE_VM_SERVICES_EPSILON_COLLECTORPOLICY_HPP
       
    26 
       
    27 #include "utilities/macros.hpp"
       
    28 #if INCLUDE_ALL_GCS
       
    29 #include "gc/epsilon/epsilonCollectedHeap.hpp"
       
    30 #include "services/memoryPool.hpp"
       
    31 #include "services/memoryUsage.hpp"
       
    32 #endif // INCLUDE_ALL_GCS
       
    33 
       
    34 class EpsilonDummyMemoryPool : public CollectedMemoryPool {
       
    35 public:
       
    36   EpsilonDummyMemoryPool();
       
    37   MemoryUsage get_memory_usage()      { return MemoryUsage(0, 0, 0, 0); }
       
    38   size_t used_in_bytes()              { return 0; }
       
    39   size_t max_size() const             { return 0; }
       
    40 };
       
    41 
       
    42 class EpsilonMemoryPool : public CollectedMemoryPool {
       
    43 private:
       
    44   const static size_t _undefined_max = (size_t) -1;
       
    45   EpsilonCollectedHeap* _heap;
       
    46 
       
    47 public:
       
    48   EpsilonMemoryPool(EpsilonCollectedHeap* heap);
       
    49 
       
    50   size_t committed_in_bytes() {
       
    51     return _heap->capacity();
       
    52   }
       
    53   size_t used_in_bytes() {
       
    54     return _heap->used();
       
    55   }
       
    56   size_t max_size() const {
       
    57     return _heap->max_capacity();
       
    58   }
       
    59   MemoryUsage get_memory_usage();
       
    60 };
       
    61 
       
    62 #endif // SHARE_VM_SERVICES_EPSILON_COLLECTORPOLICY_HPP